Difference between #14 and #15 of
defaultScope

Revision #15 has been created by Gerhard Liebenberg on Nov 18, 2013, 9:10:29 PM with the memo:

No change - just typo
« previous (#14)

Changes

Title unchanged

defaultScope

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

create skip bypass disable defaultScope composite condition

Content changed

[...]
The defaultScope must be able to access these record status fields and that is why we store
their names in $rstatus_fieldname. This enables defaultScope to re-use the same name for all tables.
But in the db, the field's name in tbl1 is tbl1_rstatus_nr.
In tbl2 it is called tbl2_rstatus_nr.

Obviously you could give these fields the same name in all tables and then reference them directly in defaultScope (without using $rstatus_fieldname), but
my experience is that defaultScope sometimes have trouble disambiguating the fields if you tunnel through tables via
 
Relational Query. So I prefer
in this wiki we regard them as being disambiguating themed in the db withlike tbl1_rstatus_nr, tbl2..., tbl3... etc.

Here is the base class with the defaultScope():
[...]
3 0
5 followers
Viewed: 33 014 times
Version: 1.1
Category: How-tos
Written by: Gerhard Liebenberg
Last updated by: Gerhard Liebenberg
Created on: Apr 27, 2013
Last updated: 10 years ago
Update Article

Revisions

View all history