-
Notifications
You must be signed in to change notification settings - Fork 4
Fixes for database and setup commands (CFM-535) #435
Fixes for database and setup commands (CFM-535) #435
Conversation
2c976c1 to
226f1ea
Compare
|
rebased agasinst latest develop |
…ludes all entity options (CFM-535)
|
@benno do we need normalization to run during the setup? |
| $entityOptions = []; | ||
| foreach($options as $k => $v) { | ||
| $entityOptions[$k] = $v; | ||
| } | ||
| $entityOptions['skipNormalization'] = true; | ||
|
|
||
| // This will recurse, so make sure to break the loop | ||
| $entity = $Table->newEntity((array)$data, options: ['skipNormalization' => true]); | ||
| $entity = $Table->newEntity((array)$data, options: $entityOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could more concisely use something like
$Table->newEntity((array)$data, options: array_merge($options, ['skipNormalization' => trp.]));
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benno since we are going compact, we should better use the unpacking:
$entity = $Table->newEntity(
(array)$data,
options: [...$options, 'skipNormalization' => true]
);since the skipNormalization is placed after the $options it will always override whatever $options have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source has been updated to use the unpacking approach.
I'm not sure we need it, though it might be nice to have. If an admin puts an extra space in their name, is there a reason not to remove it? |
Good point |
This PR solves two problems:
./bin/cake databasecommand was failing with:[Cake\Database\Exception\QueryException] [default] SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "plugins" does not existThe QueryException was not being caught.