Hi!
I dont understand why this isnt working :
In the ‘gol’ model i have the relation with ‘partido’.
This isn’t filtering by ‘partido.id_fecha’
$criteria->addCondition('gol.id_equipo = '.(int)$_GET['id_equipo']);
$models = gol::model()->with(array(
'equipo',
'jugador',
'partido.equipoA',
'partido.equipoB',
'partido.fecha.torneo',
'partido' => array('condition' => 'partido.id_fecha = '.(int)$_GET['id_fecha']),
)
)->findAll($criteria);
And this shows me an error:
$criteria->addCondition('gol.id_equipo = '.(int)$_GET['id_equipo']);
$criteria->addCondition('partido.id_fecha = '.(int)$_GET['id_fecha']);
$models = gol::model()->with(array(
'equipo',
'jugador',
'partido.equipoA',
'partido.equipoB',
'partido.fecha.torneo',
'partido'
)
)->findAll($criteria);
SQL: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘partido.id_fecha’ in ‘where clause’
How can i use conditions from other objects (tables) when joining with the "with()" method?
My first example corresponds to this : http://www.yiiframework.com/doc/api/CActiveRecord#with-detail
Where is this example that doesnt work for me: