Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is syntax for "options" in Doctrine 2.1 @Column annotation?

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

like image 698
PartialOrder Avatar asked Oct 26 '11 13:10

PartialOrder


1 Answers

The correct syntax is this:

@ORM\Column(type="string", length=49, options={"fixed":true}, nullable=false)
like image 158
Patrick Li Avatar answered Dec 24 '22 17:12

Patrick Li