chg: [Organisation] Moved model to use meta-field behavior instead of association

pull/93/head
Sami Mokaddem 2021-11-11 14:50:25 +01:00
parent 0dfa87be6f
commit 6579482526
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
4 changed files with 7 additions and 11 deletions

View File

@ -33,14 +33,7 @@ class OrganisationsTable extends AppTable
'conditions' => ['owner_model' => 'organisation'] 'conditions' => ['owner_model' => 'organisation']
] ]
); );
$this->hasMany( $this->addBehavior('MetaFields');
'MetaFields',
[
'dependent' => true,
'foreignKey' => 'parent_id',
'conditions' => ['MetaFields.scope' => 'organisation']
]
);
$this->setDisplayField('name'); $this->setDisplayField('name');
} }

View File

@ -44,6 +44,7 @@ echo $this->element('genericElements/IndexTable/index_table', [
'name' => __('Name'), 'name' => __('Name'),
'class' => 'short', 'class' => 'short',
'data_path' => 'name', 'data_path' => 'name',
'sort' => 'name',
], ],
[ [
'name' => __('UUID'), 'name' => __('UUID'),
@ -67,14 +68,17 @@ echo $this->element('genericElements/IndexTable/index_table', [
[ [
'name' => __('Nationality'), 'name' => __('Nationality'),
'data_path' => 'nationality', 'data_path' => 'nationality',
'sort' => 'nationality',
], ],
[ [
'name' => __('Sector'), 'name' => __('Sector'),
'data_path' => 'sector', 'data_path' => 'sector',
'sort' => 'sector',
], ],
[ [
'name' => __('Type'), 'name' => __('Type'),
'data_path' => 'type', 'data_path' => 'type',
'sort' => 'type',
], ],
[ [
'name' => __('Tags'), 'name' => __('Tags'),

View File

@ -48,8 +48,7 @@ echo $this->element(
'scope' => 'organisations' 'scope' => 'organisations'
] ]
], ],
'metaTemplates' => empty($metaFields) ? [] : $metaFields, 'combinedFieldsView' => false,
'combinedFieldsView' => true,
'children' => [] 'children' => []
] ]
); );