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 12: YAML Schema Files 204<br />

Listing<br />

12-20<br />

$this->index('name_index', array(<br />

'fields' => array(<br />

'first_name' => array(<br />

'sorting' => 'ASC',<br />

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

'primary' => true<br />

),<br />

'last_name' => array()),<br />

'type' => 'unique'<br />

)<br />

);<br />

Inheritance<br />

Below we will demonstrate how you can setup the differ<strong>en</strong>t types of inheritance using YAML<br />

schema files.<br />

Simple Inheritance<br />

---<br />

Entity:<br />

columns:<br />

name: string(255)<br />

username: string(255)<br />

password: string(255)<br />

User:<br />

inheritance:<br />

ext<strong>en</strong>ds: Entity<br />

type: simple<br />

Group:<br />

inheritance:<br />

ext<strong>en</strong>ds: Entity<br />

type: simple<br />

Any columns or relationships defined in models that ext<strong>en</strong>d another in simple inheritance<br />

will be moved to the par<strong>en</strong>t wh<strong>en</strong> the PHP classes are built.<br />

Listing<br />

12-21<br />

You can read more about this topic in the :section Simple (page 231) chapter.<br />

Concrete Inheritance<br />

---<br />

TextItem:<br />

columns:<br />

topic: string(255)<br />

Comm<strong>en</strong>t:<br />

inheritance:<br />

ext<strong>en</strong>ds: TextItem<br />

type: concrete<br />

columns:<br />

cont<strong>en</strong>t: string(300)<br />

You can read more about this topic in the :section Concrete (page 232) chapter.<br />

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

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

Saved successfully!

Ooh no, something went wrong!