I'm feeling stupid, but I have a strange AR problem:
I have 2 tables: Album and Photo
The relation of Album to Photo is a
'photos'=>array(self::HAS_MANY, 'Photo', 'PhAlId'),
When I do the following: ($_GET['id'] has a value)
$album=Album::model() ->with(array('photos'=>array('condition' => 'PhRecStatus=2'))) ->findAllByPk($_GET['id']); $this->render('show',array('album'=>$album));
and in my view (for test):
foreach($album as $photo)
my output is 1 (one) number 1.
When I run the query in my database, it gives me four records back. I also cannot echo $photo->photos->PhFileName (and PhFileName is a valid column name in table Photo) inside the foreach loop. I get an error: Trying to get property of non-object.
Can anyone help me with this?