fix: [Individuals Model] Table updated with relations and smarter UUID handling
parent
e7cc383cbf
commit
1fde2d7a8e
|
@ -11,6 +11,7 @@ class IndividualsTable extends AppTable
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void
|
||||||
{
|
{
|
||||||
parent::initialize($config);
|
parent::initialize($config);
|
||||||
|
$this->addBehavior('UUID');
|
||||||
$this->hasMany(
|
$this->hasMany(
|
||||||
'Alignments',
|
'Alignments',
|
||||||
[
|
[
|
||||||
|
@ -25,6 +26,12 @@ class IndividualsTable extends AppTable
|
||||||
'conditions' => ['owner_type' => 'individual']
|
'conditions' => ['owner_type' => 'individual']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
$this->hasOne(
|
||||||
|
'Users'
|
||||||
|
);
|
||||||
|
$this->belongsToMany('Organisations', [
|
||||||
|
'through' => 'Alignments',
|
||||||
|
]);
|
||||||
$this->setDisplayField('email');
|
$this->setDisplayField('email');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +39,7 @@ class IndividualsTable extends AppTable
|
||||||
{
|
{
|
||||||
$validator
|
$validator
|
||||||
->notEmptyString('email')
|
->notEmptyString('email')
|
||||||
->notEmptyString('uuid')
|
->requirePresence(['email'], 'create');
|
||||||
->requirePresence(['email', 'uuid'], 'create');
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue