I now want to know, what i can do this:
$criteria = new CDbCriteria;
$criteria->alias = 'products';
$criteria->compare('imagetag.alias', 'backgrounds');
$criteria->compare('optiontag.alias', 'prices');
$criteria->compare('pagetag.alias', 'availables');
$products = Products::model()->with(
array(
'item' => array(
'with' => array(
'itemtags.tag',
'page.item.itemtags.tag',
'itemimages.image.item.itemtags.tag',
'itemoptions.option.item.itemtags.tag'
),
),
)
)->findAll($criteria);
It gives Exception in 1.1.16
Please give me some help.
It works for me, but i want make less code:
$products = Products::model()->with(
array(
'page' => array(
'together' => true,
'with' => array(
'item' => array(
'together' => true,
'alias' => 'page_item',
'with' => array(
'itemtags' => array(
'together' => true,
'alias' => 'page_itemtags',
'with' => array(
'tag' => array(
'alias' => 'page_tag',
'together' => true
),
),
),
),
),
),
),
'itemoptions' => array(
'together' => true,
'with' => array(
'option' => array(
'together' => true,
'with' => array(
'item' => array(
'together' => true,
'alias' => 'option_item',
'with' => array(
'itemtags' => array(
'together' => true,
'alias' => 'option_itemtags',
'with' => array(
'tag' => array(
'alias' => 'option_tag',
'together' => true
),
),
),
),
),
),
),
),
),
'itemimages' => array(
'together' => true,
'with' => array(
'image' => array(
'together' => true,
'with' => array(
'item' => array(
'together' => true,
'alias' => 'image_item',
'with' => array(
'itemtags' => array(
'together' => true,
'alias' => 'image_itemtags',
'with' => array(
'tag' => array(
'alias' => 'image_tag',
'together' => true
),
),
),
),
),
),
),
),
),
'itemtags' => array(
'with' => array(
'tag' => array(
'together' => true
),
)
)
)
)->findAll();