Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function bootstrap(): void
$this->addPlugin($p->plugin);
}
}
catch(\Cake\Database\Exception\DatabaseException $e) {
catch(\Cake\Database\Exception\QueryException | \Cake\Database\Exception\DatabaseException $e) {
// Most likely we are performing the initial database setup and
// the plugins table is missing.
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/Command/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function execute(Arguments $args, ConsoleIo $io)
'co_id' => $co_id,
'status' => SuspendableStatusEnum::Active
],
['validate' => false]);
['validate' => false, 'skipNormalization' => true]);

$person->names = [$coTable->People->Names->newEntity([
'type_id' => $coTable->Types->getTypeId(coId: $co_id,
Expand All @@ -158,7 +158,7 @@ public function execute(Arguments $args, ConsoleIo $io)
'family' => $sn,
'primary_name' => true
],
['validate' => false])];
['validate' => false, 'skipNormalization' => true])];

$person->identifiers = [$coTable->People->Identifiers->newEntity([
'type_id' => $coTable->Types->getTypeId(coId: $co_id,
Expand All @@ -168,7 +168,7 @@ public function execute(Arguments $args, ConsoleIo $io)
'login' => true,
'status' => SuspendableStatusEnum::Active
],
['validate' => false])];
['validate' => false, 'skipNormalization' => true])];

$person->person_roles = [$coTable->People->PersonRoles->newEntity([
'affiliation_type_id' => $coTable->Types->getTypeId(coId: $co_id,
Expand All @@ -177,18 +177,18 @@ public function execute(Arguments $args, ConsoleIo $io)
'title' => __d('command', 'se.person_role.title'),
'status' => SuspendableStatusEnum::Active
],
['validate' => false])];
['validate' => false, 'skipNormalization' => true])];

$g = $coTable->Groups->find('adminGroup', co_id: $co_id)->firstOrFail();

$person->group_members = [
$coTable->People->GroupMembers->newEntity(
['group_id' => $g->id],
['validate' => false]
['validate' => false, 'skipNormalization' => true]
),
$coTable->People->GroupMembers->newEntity(
['group_id' => $g->owners_group_id],
['validate' => false]
['validate' => false, 'skipNormalization' => true]
)
];

Expand Down
6 changes: 4 additions & 2 deletions app/src/Model/Behavior/NormalizationBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $opti

// We need the CO for the record in order to find the appropriate configuration(s) to use,
// but for that we need $data in entity form.

// This will recurse, so make sure to break the loop
$entity = $Table->newEntity((array)$data, options: ['skipNormalization' => true]);
$entity = $Table->newEntity(
(array)$data,
options: [...$options, 'skipNormalization' => true]
);

$coId = $Table->calculateCoForRecord($entity);

Expand Down