Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Inspecao Model
- public function relations()
- {
- return array(
- 'unidade' => array(self::BELONGS_TO, 'Unidade', 'unidade_id')
- );
- /* I was trying to access 'Kit' from here, as so:
- return array(
- 'unidade' => array(self::BELONGS_TO, 'Unidade', 'unidade_id'),
- 'em_kit'=>array(self::HAS_MANY,'EmKit',array('id'=>'unidade_id'),'through'=>'unidade'),
- 'kit'=>array(self::BELONGS_TO,'Kit','kit_id','through'=>'em_kit')
- );
- */
- }
- // Unidade Model
- public function relations()
- {
- return array(
- 'inspecoes'=>array(self::HAS_MANY, 'Inspecao', 'unidade_id'),
- 'em_kit'=>array(self::HAS_ONE, 'EmKit', 'unidade_id'),
- );
- }
- // EmKit Model
- public function relations()
- {
- return array(
- 'unidade' => array(self::BELONGS_TO,'Unidade', 'unidade_id'),
- 'kit' => array(self::BELONGS_TO,'Kit', 'kit_id'),
- );
- }
- // Kit Model
- public function relations()
- {
- return array(
- 'unidades'=>array(self::HAS_MANY, 'EmKit', 'kit_id'),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement