Changes
Title
unchanged
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.
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
reuse filtering criteria; parameterized named scope in dataprovider
Content
changed
[...]
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.
### Warning:
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. Here is a wiki on [defaultScope](http://www.yiiframework.com/wiki/486/defaultscope/ "defaultScope") doing the same kind of thing as shown in this wiki.
Thanx