CRUD\Controller\ControllerTrait::_isActionMapped PHP Method

_isActionMapped() protected method

Check if an action can be dispatched using CRUD.
protected _isActionMapped ( ) : boolean | Component
return boolean | Cake\Controller\Component The component instance if action is mapped else `false`.
    protected function _isActionMapped()
    {
        if (!empty($this->dispatchComponents)) {
            foreach ($this->dispatchComponents as $component => $enabled) {
                if (empty($enabled)) {
                    continue;
                }
                // Skip if isActionMapped isn't defined in the Component
                if (!method_exists($this->{$component}, 'isActionMapped')) {
                    continue;
                }
                // Skip if the action isn't mapped
                if (!$this->{$component}->isActionMapped()) {
                    continue;
                }
                // Skip if execute isn't defined in the Component
                if (!method_exists($this->{$component}, 'execute')) {
                    continue;
                }
                // Return the component instance.
                return $this->{$component};
            }
        }
        return false;
    }