Created
September 2, 2011 17:56
-
-
Save intel352/1189307 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ordersForShipping=new CActiveDataProvider( Orders::model()->with(array( | |
'cart'=>array( | |
/* | |
* Ensure occurs in same query | |
*/ | |
'together'=>true, | |
'joinType'=>'INNER JOIN', | |
'with'=>array( | |
'items'=>array( | |
/* | |
* Ensure they exist without selecting data | |
*/ | |
'select'=>false, | |
'together'=>true, | |
'joinType'=>'INNER JOIN', | |
'with'=>array( | |
'shipment'=>array( | |
'select'=>false, | |
'together'=>true, | |
'joinType'=>'LEFT JOIN', | |
/* | |
* Important: This condition must exist in WHERE statement, not JOIN | |
* I think it works here, but needs to be tested with Yii generated query displayed | |
* Also, the alias in the condition may need correcting | |
*/ | |
'condition'=>'shipment.id IS NULL' | |
), | |
) | |
), | |
) | |
), | |
))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment