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 19: Data Fixtures 288<br />

}<br />

);<br />

)<br />

}<br />

public function setUp()<br />

{<br />

$this->actAs('NestedSet');<br />

}<br />

class BaseArticle ext<strong>en</strong>ds <strong>Doctrine</strong>_Record<br />

{<br />

public function setTableDefinition()<br />

{<br />

$this->hasColumn('title', 'string', 255, array(<br />

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

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

)<br />

);<br />

}<br />

$this->hasColumn('body', 'clob', null, array(<br />

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

)<br />

);<br />

}<br />

public function setUp()<br />

{<br />

$this->actAs('I18n', array('fields' => array('title', 'body')));<br />

}<br />

Listing<br />

19-9<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 />

---<br />

# schema.yml<br />

Resource:<br />

columns:<br />

name: string(255)<br />

resource_type_id: integer<br />

relations:<br />

Type:<br />

class: ResourceType<br />

foreignAlias: Resources<br />

Tags:<br />

class: Tag<br />

refClass: ResourceTag<br />

foreignAlias: Resources<br />

ResourceType:<br />

columns:<br />

name: string(255)<br />

Tag:<br />

columns:<br />

name: string(255)<br />

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

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

Saved successfully!

Ooh no, something went wrong!