/** * Initialize a table instance. Called after the constructor. * * @param array $config * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('pages'); $this->primaryKey('id'); $this->behaviors()->load('Union/Core.Process', ['actions' => ['custom_delete' => 'bulkCustomDelete', 'disabled' => false]]); }
/** * Initialize a table instance. Called after the constructor. * * @param array $config * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('pages'); $this->primaryKey('id'); $this->entityClass(''); }
/** * Initialize a table instance. Called after the constructor. * * @param array $config * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('pages'); $this->primaryKey('id'); $this->entityClass('TestApp\\Model\\Entity\\CustomEntity'); }
/** * Initialize a table instance. Called after the constructor. * * @param array $config * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('params'); $this->primaryKey('id'); $this->displayField('title'); $this->behaviors()->load('Union/Core.Cached', ['config' => 'test_cached', 'groups' => ['cached']]); }
/** * Initialize a table instance. Called after the constructor. * * @param array $config * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('users'); $this->primaryKey('id'); $this->displayField('id'); $this->addBehavior('Timestamp'); $this->addBehavior('Search.Search'); $this->addBehavior('Acl.Acl', ['type' => 'requester']); $this->addAssociations(['belongsTo' => ['Roles' => ['foreignKey' => 'role_id', 'className' => 'Union/Community.Roles']]]); }
/** * Initialize a table instance. Called after the constructor. * * @param array $config * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('roles'); $this->primaryKey('id'); $this->displayField('title'); $this->addBehavior('Tree'); $this->addBehavior('Acl.Acl', ['type' => 'requester']); $this->addAssociations(['belongsTo' => ['ParentRole' => ['className' => 'Union/Community.Roles', 'foreignKey' => 'parent_id']]]); $this->behaviors()->load('Union/Core.Cached', ['groups' => ['roles'], 'config' => 'permission_roles']); }
/** * Load process behavior. * * @param Table $table */ protected function _loadBehavior(Table $table) { $behaviors = $table->behaviors(); if (!Arr::in('Process', $behaviors->loaded())) { $behaviors->load('Union/Core.Process'); } }
/** * Move record in tree table. * * @param Table|\Cake\ORM\Table $table * @param EntityInterface $entity * @param string $type * @param array $options * @param int $step * @return \Cake\Network\Response|null */ public function move(Table $table, EntityInterface $entity, $type = self::MOVE_UP, array $options = [], $step = 1) { $behaviors = $table->behaviors(); if (!in_array('Tree', $behaviors->loaded())) { $behaviors->load('Tree', ['scope' => $entity->get('id')]); } $behaviors->get('Tree')->config('scope', $entity->get('id')); $_options = ['success' => __d('union', 'Object has been moved.'), 'error' => __d('union', 'Object could not been moved.'), 'redirect' => ['prefix' => $this->request->param('prefix'), 'plugin' => $this->request->param('plugin'), 'controller' => $this->request->param('controller'), 'action' => 'index']]; $options = Hash::merge($_options, $options); if ($table->{$type}($entity, $step)) { $this->Flash->success($options['success']); } else { $this->Flash->error($options['error']); } return $this->_controller->redirect($options['redirect']); }