Created
September 25, 2014 19:45
-
-
Save McGaiser/9ee33ff9e46dd1fb491c to your computer and use it in GitHub Desktop.
getActions function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/Model/Table/ResourcesTable.php | |
| namespace App\Model\Table; | |
| use Cake\ORM\Table; | |
| use Cake\ORM\TableRegistry; | |
| use Cake\Validation\Validator; | |
| use ReflectionClass; | |
| class ResourcesTable extends AppTable { | |
| public function getActions($controllerName) { | |
| //debug($controllerName); | |
| //debug(class_exists('ReflectionClass')); | |
| $class = new ReflectionClass($controllerName); | |
| $actions = $class->getMethods(ReflectionMethod::IS_PUBLIC); | |
| //$controller = TableRegistry::get($controllerName); | |
| //$actions = get_class_methods($controller); | |
| return $actions; | |
| } | |
| } | |
| Controller name in this case would be 'Books' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment