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's less than 65535 it should be TEXT?
But the column is created as MEDIUMTEXT.
How do I fix this?
Symfony provides all the tools you need to use databases in your applications thanks to Doctrine, the best set of PHP libraries to work with databases. These tools support relational databases like MySQL and PostgreSQL and also NoSQL databases like MongoDB.
Well, entity is a type of object that is used to hold data. Each instance of entity holds exactly one row of targeted database table. As for the directories, Symfony2 has some expectations where to find classes - that goes for entities as well.
A repository is a way to retrieve entities, so put on repositories any method you need to get them, such as getUserByEmail or whatever.
You need to set the length:
To TINYTEXT => length = 255
To TEXT => length = 65535
To MEDIUMTEXT = 16777215
Default: LONGTEXT
Then, for example if you need an type text, it's necessary:
/**
* @ORM\Column(name="description", type="text", length=65535)
*/
You are referencing not correct type in the documentation. In your code you have type="string"
but your reference to documentation is related to type="object"
.
If you read the part of table above in the referenced docs you will see that string
is casted to VARCHAR
in MySQL if length
does not exceed the maximum length for MySQL and is casted to MEDIUMTEXT
if length
exceeds.
But If you want to get explicitly TEXT
field you will need to define your column with type="text"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With