Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

birdy247
Copy link

Adds support for duplicating tables with composite keys

@@ -35,7 +35,8 @@ class DuplicatableBehavior extends Behavior
'set' => [],
'prepend' => [],
'append' => [],
'saveOptions' => []
'saveOptions' => [],
'preserveKeyFromCompositeKey' => ''
Copy link
Collaborator

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?

Copy link
Author

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();
Copy link
Collaborator

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.

Copy link
Author

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
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants