Skip to content

Instantly share code, notes, and snippets.

@McGaiser
Created September 25, 2014 19:45
Show Gist options
  • Select an option

  • Save McGaiser/9ee33ff9e46dd1fb491c to your computer and use it in GitHub Desktop.

Select an option

Save McGaiser/9ee33ff9e46dd1fb491c to your computer and use it in GitHub Desktop.
getActions function
// 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