Its a parent child relation, In childGroup1, getting error during accessing 'PARENT_ID' attribute. The given error is Trying to get property of non-object.
I am having access dynamically.
How to get PARENT_ID in such case.
return array(
'group1'=>array(
'ID' => 1,
'NAME' => 'Test',
'STATUS' => 1,
),
'childGroup1'=>array(
'ID' => 2,
'PARENT_ID' => $this->getRecord('groups','group1')->ID,
'NAME' => 'Child Test group1',
'STATUS' => 1,
),
);
Since the records are not loaded yet, you cannot use
$this->getRecord()
to acquire a record. As such, just use plain old array logic to get the record's ID.If you need records from other fixtures, just
require
them.This, of course, would be what you put at the top of files OTHER than
groups.php
, in order to gain access to the groups models.