10.04.2018 Views

Doctrine_manual-1-2-en

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 20: Database Abstraction Layer 297<br />

add<br />

remove<br />

r<strong>en</strong>ame<br />

change<br />

Associative array with the names of fields to be added as indexes of the array. The<br />

value of each <strong>en</strong>try of the array should be set to another associative array with the<br />

properties of the fields to be added. The properties of the fields should be the same<br />

as defined by the <strong>Doctrine</strong> parser.<br />

Associative array with the names of fields to be removed as indexes of the array.<br />

Curr<strong>en</strong>tly the values assigned to each <strong>en</strong>try are ignored. An empty array should be<br />

used for future compatibility.<br />

Associative array with the names of fields to be r<strong>en</strong>amed as indexes of the array.<br />

The value of each <strong>en</strong>try of the array should be set to another associative array with<br />

the <strong>en</strong>try named name with the new field name and the <strong>en</strong>try named Declaration<br />

that is expected to contain the portion of the field declaration already in DBMS<br />

specific SQL code as it is used in the CREATE TABLE statem<strong>en</strong>t.<br />

Associative array with the names of the fields to be changed as indexes of the<br />

array. Keep in mind that if it is int<strong>en</strong>ded to change either the name of a field and<br />

any other properties, the change array <strong>en</strong>tries should have the new names of the<br />

fields as array indexes.<br />

The value of each <strong>en</strong>try of the array should be set to another associative array with the<br />

properties of the fields to that are meant to be changed as array <strong>en</strong>tries. These <strong>en</strong>tries should<br />

be assigned to the new values of the respective properties. The properties of the fields should<br />

be the same as defined by the <strong>Doctrine</strong> parser.<br />

// test.php<br />

Listing<br />

20-11<br />

// ...<br />

$alter = array('name' => 'ev<strong>en</strong>t',<br />

'add' => array(<br />

'quota' => array(<br />

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

'unsigned' => 1<br />

)<br />

),<br />

'remove' => array(<br />

'new_column2' => array()<br />

),<br />

'change' => array(<br />

'name' => array(<br />

'l<strong>en</strong>gth' => '20',<br />

'definition' => array(<br />

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

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

)<br />

)<br />

),<br />

'r<strong>en</strong>ame' => array(<br />

'new_column' => array(<br />

'name' => 'g<strong>en</strong>der',<br />

'definition' => array(<br />

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

'l<strong>en</strong>gth' => 1,<br />

'default' => 'M'<br />

)<br />

)<br />

)<br />

);<br />

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

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

Saved successfully!

Ooh no, something went wrong!