Exemple #1
0
 /**
  * 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]]);
 }
Exemple #2
0
 /**
  * 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('');
 }
Exemple #3
0
 /**
  * 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');
 }
Exemple #4
0
 /**
  * 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']]);
 }
Exemple #5
0
 /**
  * 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']]]);
 }
Exemple #6
0
 /**
  * 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']);
 }
Exemple #7
0
 /**
  * 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');
     }
 }
Exemple #8
0
 /**
  * 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']);
 }