Skip navigation.

one To many relation

HI,

i'm working with build 3 of Xyster and try out this example.
class personMapper extends Xyster_Orm_Mapper
{
// protected $_domain, etc.

public function init()
{
$meta = $this->getMeta();
$meta->one('nemesis', array('class'=>'Person', 'id'=>'nemesisId'));
$meta->many('quotes');
}
}

I get the error undefined method getMeta();
if someOne can help me further. :)

Greets Ken,

The Build 3 documentation

The Build 3 documentation seems to be incorrect again. :)

First let me say it's a better idea to be using Build 4 at this point. Anyway, for Build 3, the block of code you want should be this instead:

public function init()
{
    $meta = $this->getEntityMeta();
    $meta->hasOne('nemesis', array('class'=>'Person', 'id'=>'nemesisId'));
    $meta->hasMany('quotes');
}

In Build 4, it looks like this:

public function init()
{
    $this->_hasOne('nemesis', array('class'=>'Person', 'id'=>'nemesisId'))
        ->_hasMany('quotes');
}

-DC

thx :) for the fast response

thx :)
for the fast response

User login