Hello all,
I am French and advance sorry for my english.
I have two table "Promotion" and "specialite".
I want to display the title of my specialty for each promotion.
Here are my relationships :
PROMOTION model:
[HTML]
public function relations() {
return array(
'specialite'=>array(self::BELONGS_TO, 'Specialite', 'id_specialite'),
'filiere'=>array(self::HAS_ONE, 'Filiere', 'id_filiere',
'through'=>'specialite'),
);
}
[/HTML]
and SPECIALITE model :
[HTML]
public function relations() {
return array(
'filiere'=>array(self::BELONGS_TO, 'Filiere', 'id_filiere'),
'promotions'=>array(self::HAS_MANY, 'Promotion', 'id'),
);
}
[/HTML]
And here my code :
[HTML]
$test = Promotion::model()->with(‘specialite’)->findAll();
foreach($test as $tt) {
echo ($tt->date_debut.' : ');
echo ($tt->specialite->intitule.'<br/>');
}
[/HTML]
But I have an error message :
[HTML]
Trying to get property of non-object
on this ligne : echo ($tt->specialite->intitule.’<br/>’);
[/HTML]
Thank you in advance for your help
Best regards
Arteckos