Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Multi Relation Problem

$
0
0
Hi everyone

I have a strange issue in cgridview with sorting or searching a related AR model

If the related field is first lever everything works fine
for example $criteria->compare('category.category_id', $this->rel_catid, true); (category is related with product)

but in this case occurs error "CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found"
$criteria->compare('category.groups.group_id', $this->rel_group, true); (category is related with product, and group related with category)

in the message error I can see only one LEFT OUTER JOIN with category but I do not see JOIN with group table.
I am sure the relation exist (I created by myself) also there is no problem with echo $modelProduct->category->groups->group_id in view file.

The same problem occurs when I sorting the specific field in CGridView

What I am missing?
Thanks

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>