get action names from model

Is there a way to get all action names of a controller from a model, I tried this in profile model class:

$profileController=new ProfileController();


    foreach($methods as $method){



but got an error asking to include the profileController.php file, which is not an elegant way to do, does anybody know a better way? thanks for help.

you shouldn’t do that :lol:

this is went against the layer design pattern . the model layer shouldn’t refer to the higher layer(controller layer ) ;

even this can be done as you did:

just import the controller ,use the reflection ;

   Yii::import('application.controllers.ProfileController'); //or moduleId.controllers.XXController ; 



      you can use this in your index.php :




    foreach($methods as $method){



note as you said this is not a good way. so never access higher layer in layer architecture (you can only access lower layer);