| @@ 53-71 (lines=19) @@ | ||
| 50 | * @return void |
|
| 51 | * @throws \RuntimeException |
|
| 52 | */ |
|
| 53 | public function initialize(array $config) |
|
| 54 | { |
|
| 55 | parent::initialize($config); |
|
| 56 | ||
| 57 | $this |
|
| 58 | ->setPrimaryKey('id') |
|
| 59 | ->setTable(CMS_TABLE_GROUPS) |
|
| 60 | ->setDisplayField('name'); |
|
| 61 | ||
| 62 | $this->addBehavior('Tree'); |
|
| 63 | $this->addAssociations([ |
|
| 64 | 'belongsTo' => [ |
|
| 65 | 'ParentGroup' => [ |
|
| 66 | 'foreignKey' => 'parent_id', |
|
| 67 | 'className' => 'Community.Group' |
|
| 68 | ] |
|
| 69 | ] |
|
| 70 | ]); |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * Default validation rules. |
|
| @@ 38-58 (lines=21) @@ | ||
| 35 | * @return void |
|
| 36 | * @throws \RuntimeException |
|
| 37 | */ |
|
| 38 | public function initialize(array $config) |
|
| 39 | { |
|
| 40 | parent::initialize($config); |
|
| 41 | ||
| 42 | $this |
|
| 43 | ->setPrimaryKey('id') |
|
| 44 | ->setTable(CMS_TABLE_USERS) |
|
| 45 | ->setDisplayField('name'); |
|
| 46 | ||
| 47 | $this->addBehavior('Timestamp'); |
|
| 48 | $this->addBehavior('Search.Search'); |
|
| 49 | ||
| 50 | $this->addAssociations([ |
|
| 51 | 'belongsTo' => [ |
|
| 52 | 'Groups' => [ |
|
| 53 | 'foreignKey' => 'group_id', |
|
| 54 | 'className' => 'Community.Groups' |
|
| 55 | ] |
|
| 56 | ] |
|
| 57 | ]); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Default validation rules. |
|