Hi,
is there a way to avoid the error
I am a Yii beginner and I am wondering, because the following MySQL query on the command line (not in Yii) retrieves data even if the foreign key composer_Id is NULL:
Using relations in Yii ActiveRecord I get an error, when there are records having an empty foreign key.
Relations in tbl_main model:
Relations in tbl_related model:
Thank you for hints.
is there a way to avoid the error
Trying to get property of non-objectwhen the value of a foreign key is NULL.
I am a Yii beginner and I am wondering, because the following MySQL query on the command line (not in Yii) retrieves data even if the foreign key composer_Id is NULL:
SELECT * FROM `tbl_main` AS t LEFT JOIN tbl_related AS rel ON t.composer_Id = rel.Id
Using relations in Yii ActiveRecord I get an error, when there are records having an empty foreign key.
Relations in tbl_main model:
'composer'=>array(self::BELONGS_TO, 'tbl_related', 'composer_Id')
Relations in tbl_related model:
'items'=>array(self::HAS_MANY, 'tbl_main', 'composer_Id')
Thank you for hints.