#1050: Generated model of a hierarchy of behavior expressed in yaml is wrong.
---------------------------------------------+----------------------------- -
Reporter: masterzen | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone: 0.11.3
Component: Behaviors | Version: 0.11
Keywords: hierarchy plugin patch testcase |
---------------------------------------------+----------------------------- -
Since #936 is now fixed, we certainly want to be able to express a
hierarchy of plugin/template/behaviors in YAML schemas and import them to
generate the right models directly.
Something along the line of:
{{{
---
Wiki:
actAs:
I18n:
fields: [title, content]
actAs:
Versionable:
fields: [title, content]
Searchable:
fields: [title, content]
Sluggable:
fields: [title]
columns:
title: string(255)
content: string
}}}
Or even a sample of a more complex hierarchy as outlined here:
{{{
Question:
actAs:
I18n:
fields: [...]
actAs:
Versionable:
fields: [...]
actAs:
Timestampable:
created:
name: created_at
type: timestamp
format:Y-m-d H:i:s
updated:
disabled: true
DoW_Doctrine_Template_Authorable:
Searchable:
fields: [text]
columns:
....
}}}
Included in this ticket is a patch against 0.11RC2 (let me know for patch
against current 0.11 branch) which enhances the Doctrine_Import_Builder to
generate the following code samples (from example 1) in the generated
models:
{{{
class BaseWiki extends Doctrine_Record
{
...
public function setUp()
{
parent::setUp();
# adding behavior: I18n
$i18n0 = new Doctrine_Template_I18n(array('fields' => array( 0 =>
'title', 1 => 'content', )));
#1 adding behavior: Versionable
$versionable1 = new Doctrine_Template_Versionable(array('fields' =>
array( 0 => 'title', 1 => 'content', )));
$i18n0->addChild($versionable1);
# adding behavior: Searchable
$searchable1 = new Doctrine_Template_Searchable(array('fields' =>
array( 0 => 'title', 1 => 'content', )));
$i18n0->addChild($searchable1);
# adding behavior: Sluggable
$sluggable1 = new Doctrine_Template_Sluggable(array('fields' =>
array( 0 => 'title', )));
$i18n0->addChild($sluggable1);
$this->actAs($i18n0);
}
...
}}}
--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1050>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper