Revision #22 has been created by Gerhard Liebenberg on Apr 27, 2013, 10:59:39 PM with the memo:
added link to defaultScope wiki
« previous (#21)
Parameterized Named Scope. Re-use the same set of filtering criteria in various models and controllers. Also re-use the same Parameterized Named Scope in all find() functions and in dataprovider.
reuse filtering criteria; parameterized named scope in dataprovider
[...]Use method-1 whenever you directly load records e.g. actionUpdate and actionDelete - via loadModel($id).
Use method-2 when you need a dataprovider e.g. CGridView & CListView.
This Row-Level-Access-Control I used is just an example to explain pns. However, Row-Level-Access-Control should probably involve defaultScope(), because pns is currently (Yii 1.1.12) not enforced on related tables in relational queries.