10.04.2018 Views

Doctrine_manual-1-2-en

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

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

Chapter 7: Defining Models 65<br />

$this->hasColumn('someclob', 'clob', 2147483647, array(<br />

'type' => 'clob',<br />

'l<strong>en</strong>gth' => '2147483647'<br />

)<br />

);<br />

}<br />

}<br />

$this->hasColumn('someblob', 'blob', 2147483647, array(<br />

'type' => 'blob',<br />

'l<strong>en</strong>gth' => '2147483647'<br />

)<br />

);<br />

Here is the same example in YAML format. You can read more about YAML in the YAML<br />

Schema Files (page 195) chapter:<br />

Example:<br />

tableName: example<br />

columns:<br />

id:<br />

type: string(32)<br />

fixed: true<br />

primary: true<br />

someint:<br />

type: integer(10)<br />

unsigned: true<br />

sometime:<br />

type: time(25)<br />

default: '12:34:05'<br />

notnull: true<br />

sometext: string(12)<br />

somedate: date(25)<br />

sometimestamp: timestamp(25)<br />

someboolean: boolean(25)<br />

somedecimal: decimal(18)<br />

somefloat: float(2147483647)<br />

someclob: clob(2147483647)<br />

someblob: blob(2147483647)<br />

Listing<br />

7-41<br />

The above example will create the following database table in Pgsql:<br />

Column Type<br />

id<br />

character(32)<br />

someint integer<br />

sometime time without time zone<br />

sometext character or varying(12)<br />

somedate date<br />

sometimestamp timestamp without time zone<br />

someboolean boolean<br />

somedecimal numeric(18,2)<br />

somefloat double precision<br />

someclob text<br />

----------------- Brought to you by

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

Saved successfully!

Ooh no, something went wrong!