From c2cefb4311021ad24b280cc2d7784cb2fca82b81 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 24 Nov 2021 23:59:34 +0100 Subject: [PATCH] fix: [user init] generation fixed --- src/Model/Entity/Organisation.php | 5 ----- src/Model/Table/OrganisationsTable.php | 6 +----- src/Model/Table/UsersTable.php | 3 ++- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Model/Entity/Organisation.php b/src/Model/Entity/Organisation.php index bc78378..6766963 100644 --- a/src/Model/Entity/Organisation.php +++ b/src/Model/Entity/Organisation.php @@ -10,10 +10,5 @@ class Organisation extends AppModel protected $_accessible = [ '*' => true, 'id' => false, - 'uuid' => false, - ]; - - protected $_accessibleOnNew = [ - 'uuid' => true, ]; } diff --git a/src/Model/Table/OrganisationsTable.php b/src/Model/Table/OrganisationsTable.php index 4e77c99..c56720e 100644 --- a/src/Model/Table/OrganisationsTable.php +++ b/src/Model/Table/OrganisationsTable.php @@ -11,17 +11,13 @@ class OrganisationsTable extends AppTable { public $metaFields = 'organisation'; - protected $_accessible = [ - 'id' => false - ]; - public function initialize(array $config): void { parent::initialize($config); + $this->addBehavior('UUID'); $this->addBehavior('Timestamp'); $this->addBehavior('Tags.Tag'); $this->addBehavior('AuditLog'); - $this->addBehavior('UUID'); $this->hasMany( 'Alignments', [ diff --git a/src/Model/Table/UsersTable.php b/src/Model/Table/UsersTable.php index 6b92527..2eebd8c 100644 --- a/src/Model/Table/UsersTable.php +++ b/src/Model/Table/UsersTable.php @@ -122,7 +122,8 @@ class UsersTable extends AppTable $this->Roles->save($role); $this->Organisations = TableRegistry::get('Organisations'); $organisation = $this->Organisations->newEntity([ - 'name' => 'default_organisation' + 'name' => 'default_organisation', + 'uuid' => Text::uuid() ]); $this->Organisations->save($organisation); $this->Individuals = TableRegistry::get('Individuals');