My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 1183: No way to get table alias from defaultScope
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  qiang.xue
Closed:  May 2010
Cc:  alexander.makarow

Sign in to add a comment
Project Member Reported by alexander.makarow, May 2, 2010
Using getTableAlias from defaultScope causes endless loop: getTableAlias 
calls getDbCriteria that calls defaultScope, which is calling getDbCriteria 
May 13, 2010
Project Member #1 qiang.xue
Actually, 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.
Status: Invalid
May 13, 2010
Yes, but for joined tables with defaultScopes it doesn't work

$basket = Products::model()->with('items')->findAll();
May 13, 2010
Project Member #3 qiang.xue
That's right. I will reconsider this limitation. Thanks.
Status: Accepted
May 13, 2010
Project Member #4 qiang.xue
This issue was closed by revision r2131.
Status: Fixed
May 13, 2010
Project Member #5 qiang.xue
You 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.
Sign in to add a comment

Powered by Google Project Hosting