-
Notifications
You must be signed in to change notification settings - Fork 20
handling composite key support #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -35,7 +35,8 @@ class DuplicatableBehavior extends Behavior | |||
'set' => [], | |||
'prepend' => [], | |||
'append' => [], | |||
'saveOptions' => [] | |||
'saveOptions' => [], | |||
'preserveKeyFromCompositeKey' => '' |
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.
Why is this this a string, what if composite key consistents of 3 fields and 2 need to be removed?
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.
Done
{ | ||
if (is_array($object->getPrimaryKey())) { | ||
|
||
$compositeKey = $object->getPrimaryKey(); |
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.
Make this assignment the first statement (with name $primaryKey) and avoid calling method again.
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.
Done
* | ||
* @param EntityInterface $entity | ||
* @param $object | ||
* @throws \Exception |
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.
return void missing maybe here?
Adds support for duplicating tables with composite keys