Hi,
can anybody help please. I have a User Table with many associated/related adSpaces per User in the table adSpace. Now I want to use CDBCriteria in the User Model and dont know how to create this (working when directly fired) query :
SELECT * FROM user
t
LEFT OUTER JOIN adSpace
adSpaces
ON (adSpaces
.user_id
=t
.id
) GROUP BY adSpaces.id
The following does not work as I want :
$criteria = new CDbCriteria();
$criteria->with=‘adSpaces’; or $criteria->with=array(‘adSpaces’=>array(‘condition’ => 'adSpaces.status=1));
$criteria->group=‘adSpaces.id’;
I want to have a result for every Ad Space and not every User. In my test I have 5 Ad Spaces associated to 1 User and CDBCriteria gives me 1 Result but I want 5
Is there a way to avoid CSqlDataProvider and being forced to implement this in the Ad Space Model?