How to get the Doctrine TEXT type?

I have this annotation:

/** * @ORM\Column(name="notes", type="string", length=65532, nullable=true) */ protected $notes; 

According to this document - http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#id102 , because it is less than 65535, should it be TEXT?

But the column is created as MEDIUMTEXT.

How to fix it?

+13
mysql symfony doctrine
source share
1 answer

You are referencing the wrong type in the documentation. In your code, you have type="string" , but your link to the documentation is related to type="object" .

If you read the part of the table above in the referenced documents, you will see that string converted to VARCHAR in MySQL if length does not exceed the maximum length for MySQL, and converted to MEDIUMTEXT if length exceeds.

But if you want to get an explicit TEXT field, you need to define your column using type="text" .

+16
source share

All Articles