Cake\Controller\Controller::isAction PHP 메소드

isAction() 공개 메소드

Override this method to change which controller methods can be reached. The default implementation disallows access to all methods defined on Cake\Controller\Controller, and allows all public methods on all subclasses of this class.
public isAction ( string $action ) : boolean
$action string The action to check.
리턴 boolean Whether or not the method is accessible from a URL.
    public function isAction($action)
    {
        $baseClass = new ReflectionClass('Cake\\Controller\\Controller');
        if ($baseClass->hasMethod($action)) {
            return false;
        }
        try {
            $method = new ReflectionMethod($this, $action);
        } catch (ReflectionException $e) {
            return false;
        }
        return $method->isPublic();
    }

Usage Example

예제 #1
-1
 /**
  * {@inheritdoc}
  *
  * @param string $action
  * @return bool
  */
 public function isAction($action)
 {
     if ($action == 'construct') {
         return false;
     }
     return parent::isAction($action);
 }