Good day,
i need to do the same thing as described at http://www.yiiframework.com/forum/index.php?/topic/1947-named-scopes-condition-relation-ambiguous-column-name/
but it will not work if relation name do not equals table name
for example:
Category::model()->published()->with('products:published');
in scopes i use alias option equals table name as you suggest.
But if relation name will be not ‘products’ (=table name) but ‘products2’ it will not work, because of in query we will see
SELECT ... FROM `Categories` LEFT OUTER JOIN `Products` `products2` WHERE ... (Products.published=1)
and Products.published=1 option will cause mysql error.
And i cant set scope alias = products2 because then it will not work with simple queries…
Any workaround?