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']
]
);
$this->hasMany(
'MetaFields',
[
'dependent' => true,
'foreignKey' => 'parent_id',
'conditions' => ['MetaFields.scope' => 'organisation']
]
);
$this->addBehavior('MetaFields');
$this->setDisplayField('name');
}

View File

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

View File

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

View File

@ -24,4 +24,4 @@ if (!isset($params['escape']) || $params['escape'] !== false) {
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>
<?php endif; ?>
<?php endif; ?>