I'm trying to define a column in Doctrine 2.1 (using annotations) that maps to a fixed length CHAR column in MySQL. Using fixed=true doesn't do the job. The annotation
* @ORM\Column(type="string", length=49, fixed=true, nullable=false)
it results in an error: "The annotation @ORM\Column declared on property [name here] does not have a property named "fixed". Available properties: name, type, length, precision, scale, unique, nullable, options, columnDefinition". So I'm assuming that the "fixed" bit needs to be passed in "options". But how? I've scoured the Doctrine 2.1 documentation and cannot find anything on this.
I tried
* @ORM\Column(type="string", length=49, options="fixed=true", nullable=false)
which doesn't result in an error, but is ignored -- the column created is VARCHAR (49).
I'd prefer not to use columnDefinition.
Any suggestions?
THANKS
The correct syntax is this:
@ORM\Column(type="string", length=49, options={"fixed":true}, nullable=false)
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