| @@ 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. |
|
| @@ 44-64 (lines=21) @@ | ||
| 41 | * |
|
| 42 | * @throws \RuntimeException |
|
| 43 | */ |
|
| 44 | public function initialize(array $config) |
|
| 45 | { |
|
| 46 | parent::initialize($config); |
|
| 47 | ||
| 48 | $this |
|
| 49 | ->setPrimaryKey('id') |
|
| 50 | ->setTable(CMS_TABLE_USERS) |
|
| 51 | ->setDisplayField('name'); |
|
| 52 | ||
| 53 | $this->addBehavior('Timestamp'); |
|
| 54 | $this->addBehavior('Search.Search'); |
|
| 55 | ||
| 56 | $this->addAssociations([ |
|
| 57 | 'belongsTo' => [ |
|
| 58 | 'Groups' => [ |
|
| 59 | 'foreignKey' => 'group_id', |
|
| 60 | 'className' => 'Community.Groups' |
|
| 61 | ] |
|
| 62 | ] |
|
| 63 | ]); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Persists an entity based on the fields that are marked as dirty and |
|