defaultScope

Comparing #14 with #15

Revision #15 was created by Gerhard Liebenberg Gerhard Liebenberg on Nov 18, 2013, 9:10:29 PM.

No change - just typo

Content

[...]
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():
[...]