21.10.2015 Views

1-33

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Symfony2 – Franz Jordán 2011<br />

smallint<br />

bigint<br />

decimal<br />

float<br />

Dates and Times (use a DateTime object for these fields in PHP)<br />

date<br />

time<br />

datetime<br />

Other Types<br />

boolean<br />

object (serialized and stored in a CLOB field)<br />

array (serialized and stored in a CLOB field)<br />

For more information, see Doctrine's Mapping Types documentation.<br />

Field Options<br />

Each field can have a set of options applied to it. The available options include type (defaults<br />

tostring), name, length, unique and nullable. Take a few annotations examples:<br />

/**<br />

* A string field with length 255 that cannot be null<br />

* (reflecting the default values for the "type", "length" and *nullable* options)<br />

*<br />

* @ORM\Column()<br />

*/<br />

protected $name;<br />

/**<br />

* A string field of length 150 that persists to an "email_address" column<br />

* and has a unique index.<br />

*<br />

* @ORM\Column(name="email_address", unique="true", length="150")<br />

*/<br />

protected $email;<br />

There are a few more options not listed here. For more details, see Doctrine'sProperty Mapping<br />

documentation<br />

Console Commands<br />

The Doctrine2 ORM integration offers several console commands under<br />

the doctrine namespace. To view the command list you can run the console without any<br />

arguments:<br />

php app/console<br />

101

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!