Doctrine, Error: Unknown column type „varchar(10)“ requested

blkvcv
Člen | 1
+
0
-

Ahoj,

som začiatočník v Doctrine a snažím sa postupovať podľa tutoriálov (http://blog.honzacerny.com/…te-framework), zasekla som sa na mieste, kde si chcem dump-núť výpisy z databázy.
Databázu som si vytvorila cez konzolu Doctriny, má tri tabuľky.

Tabuľka séria:

/**
 * @ORM\Entity
 */
class Series extends Kdyby\Doctrine\Entities\BaseEntity
{
	use Kdyby\Doctrine\Entities\Attributes\Identifier;

	/**
	 * @ORM\Column(type="date")
	 */
	protected $date;

	/**
	 * @ORM\Column(type="text", nullable=true)
	 */
	protected $description;

	/**
	 * @ORM\Column(type="string", length=10)
	 */
	protected $mi_catalog;

	/**
	 * @ORM\Column(type="decimal", precision=6, scale=2, nullable=true)
	 */
	protected $mi_cost_per;

	/**
	 * @ORM\Column(type="decimal", precision=6, scale=2, nullable=true)
	 */
	protected $mi_cost_non_per;

	/**
	 * @ORM\Column(type="boolean", nullable=true)
	 */
	protected $own_per;

	/**
	 * @ORM\Column(type="boolean", nullable=true)
	 */
	protected $own_non_per;

	/**
	 * @ORM\Column(type="text", nullable=true)
	 */
	protected $buying_info;

	/**
	 * @ORM\Column(type="text", nullable=true)
	 */
	protected $image_link;

	/**
	 * @ORM\Column(type="datetime")
	 * @ORM\Version
	 */
	protected $created_at;

	/**
	 * @ORM\ManyToOne(targetEntity="App\Model\WorldCup", inversedBy="series")
	 */
	private $world_cup;

	/**
	 * @ORM\OneToMany(targetEntity="App\Model\Stamp", mappedBy="series")
	 */
	private $stamps;

	public function __construct()
	{
		$this->stamps = new ArrayCollection();
	}
}

Tabuľka známka:

/**
 * @ORM\Entity
 */
class Stamp extends Kdyby\Doctrine\Entities\BaseEntity
{
	use Kdyby\Doctrine\Entities\Attributes\Identifier;

	/**
	 * @ORM\Column(type="boolean")
	 */
	protected $type;

	/**
	 * @ORM\Column(type="decimal", precision=6, scale=2)
	 */
	protected $nom_value;

	//Doctrine does not validate the length of a string values for you.
	/**
	 * @ORM\Column(type="string", length=8, nullable=true)
	 */
	protected $mi_catalog_number_per;

	/**
	 * @ORM\Column(type="string", length=8, nullable=true)
	 */
	protected $mi_catalog_number_non_per;

	/**
	 * @ORM\ManyToOne(targetEntity="App\Model\Series", inversedBy="stamps")
	 */
	private $series;

}

Tabuľka MS:

/**
 * @ORM\Entity
 * @ORM\Table(name="world_cup")
 */
class WorldCup extends Kdyby\Doctrine\Entities\BaseEntity
{
	//getId() function involved
	use Kdyby\Doctrine\Entities\Attributes\Identifier;

	/**
	 * @ORM\Column(type="string", length=50)
	 */
	protected $state;

	/**
	 * @ORM\Column(type="date")
	 */
	protected $year;

	/**
	 * @ORM\OneToMany(targetEntity="App\Model\Series", mappedBy="world_cup")
	 */
	private $series;

	public function __construct()
	{
		$this->series = new ArrayCollection();
	}
}

Po vytvorení tabuliek mi dump vypísal tri prázdne arrays. Používam XAMPP, cez phpmyadmin som si databázu naplnila a po refreshnutí mi Tracy vypísala chybu:

Doctrine\DBAL\DBALException

Unknown column type „varchar(10)“ requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.

Chyba je na riadku dump($dao_series->findAll());, takže som postupovala logicky – zakomentovala som riadok, dump z dao_stamps a dump z dao_world_cup mi dal dve naplnené polia, takže to funguje (pričom v tabuľke Stamps mám 2× varchar(8) a to ničomu nevadí). Skúsila som zmeniť length v db cez phpmyadmin aj cez doctrinu, skúsila som zmeniť typ na text cez doctrinu, dropla som databázu, creatla som databázu nanovo s iným typom (varchar(10) sa tam momentálne nikde nenachádza), a chybová hláška zostala. Skúsila som natvrdo vymazať cache, neviem čo ďalej.

Ďakujem za pomoc.