Using getTableAlias from defaultScope causes endless loop: getTableAlias calls getDbCriteria that calls defaultScope, which is calling getDbCriteria etc.
http://www.yiiframework.com/forum/index.php?/topic/9036-trying-to-get-table- alias-regularly-crashes/
Comment #1
Posted on May 13, 2010 by Helpful CamelActually, it doesn't make sense to call getTableAlias in defaultScope because defaultScope is always the first scope being applied. That means, 't' should always be returned in this case.
Comment #2
Posted on May 13, 2010 by Massive BirdYes, but for joined tables with defaultScopes it doesn't work
$basket = Products::model()->with('items')->findAll();
Comment #3
Posted on May 13, 2010 by Helpful CamelThat's right. I will reconsider this limitation. Thanks.
Comment #4
Posted on May 13, 2010 by Helpful CamelThis issue was closed by revision r2131.
Comment #5
Posted on May 13, 2010 by Helpful CamelYou may now call $this->getTableAlias(false,false) in defaultScope() and scopes() to retrieve the currently active table alias. Please let me know if you encounter any problem. Thanks.
Status: Fixed
Labels:
Priority-Medium
Milestone-1.1.3