Acl\Model\Behavior\AclBehavior::__construct PHP Method

__construct() public method

Sets up the configuration for the model, and loads ACL models if they haven't been already
public __construct ( Table $model, array $config = [] ) : void
$model Cake\ORM\Table Table instance being attached
$config array Configuration
return void
    public function __construct(Table $model, array $config = [])
    {
        $this->_table = $model;
        if (isset($config[0])) {
            $config['type'] = $config[0];
            unset($config[0]);
        }
        if (isset($config['type'])) {
            $config['type'] = strtolower($config['type']);
        }
        parent::__construct($model, $config);
        $types = $this->_typeMaps[$this->config()['type']];
        if (!is_array($types)) {
            $types = [$types];
        }
        foreach ($types as $type) {
            $alias = Inflector::pluralize($type);
            $className = App::className($alias . 'Table', 'Model/Table');
            if ($className == false) {
                $className = App::className('Acl.' . $alias . 'Table', 'Model/Table');
            }
            $config = [];
            if (!TableRegistry::exists($alias)) {
                $config = ['className' => $className];
            }
            $model->hasMany($type, ['targetTable' => TableRegistry::get($alias, $config)]);
        }
        if (!method_exists($model->entityClass(), 'parentNode')) {
            trigger_error(__d('cake_dev', 'Callback {0} not defined in {1}', ['parentNode()', $model->entityClass()]), E_USER_WARNING);
        }
    }