Check Multi Access In Yii With Execute Just Single Query Db


I’m using Yii framework, and CDbAuthManager class for authorization users. For check one access can use this code:


This code execute a db query, It’s here in background:

SELECT * FROM `auth_item` WHERE name='post'

Now If I check other access, then execute another db query:


SELECT * FROM `auth_item` WHERE name='comment'

Now if I need to check many of access, so execute many db query. Now, how can I check multi access, So that just execute single query db. For example I wish have a code be like this:

Yii::app()->user->checkAccess(array('post', 'comment'));

And maybe execute be like this query for that:

SELECT * FROM `auth_item` WHERE name IN ('post', 'comment');

Any idea?!

[color="#000080"][b]I find a solution and write a component for it here: