Yii execute code after method

In order to execute a specific code after a Yii controller method (action) called you can proceed by using the following method: afterAction

You cannot specify the action or not

here’s an example:

with the same principle you can call the method: beforeAction

do not forget however to return true before end of the method


Yii CSqlDataProvider sort

In order to sort Yii CSqlDataProvider you have to pass CSort() object to it.

In case the CSqlDataProvider is not sorted you should probably check your query passed to the object. Pay attention not to add a semicolon at the end of your query.