Skip to content
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

Unique option not working with templates (issue #291) #359

Closed
wants to merge 12 commits into from

Conversation

reinfi
Copy link
Contributor

@reinfi reinfi commented May 16, 2016

PR fixes #291

@@ -0,0 +1,6 @@
\Nelmio\Alice\support\models\User:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a more complete test for that one, e.g. add another non unique field to the template. It would be also good to have another example with two level deep, i.e.

  • template1: 2 fields with unique, 1 without
  • template2: extends template 1, override 1 unique field to make it not unique, add another unique field
  • 3: extends template 1

Don't hesitate to create dedicated entities for it if needed

@theofidry
Copy link
Member

Again thanks a lot for looking into it! It's definitely an issue that I don't think I would have had the time to look before a while!

@reinfi
Copy link
Contributor Author

reinfi commented May 17, 2016

I will setup more tests and will change the implementation also so that it will be more flexible for other extensions.

@theofidry
Copy link
Member

so that it will be more flexible for other extensions.

Don't over do it though, v3 is coming out ;)

@reinfi
Copy link
Contributor Author

reinfi commented May 17, 2016

good advice for the tests because I found another bug within template inheritance.

@theofidry theofidry added this to the 2.x milestone May 22, 2016
@theofidry
Copy link
Member

@reinfi what is the status of the PR? Is there any work left or is it ready for review?

@reinfi
Copy link
Contributor Author

reinfi commented Jun 29, 2016

it is rady for review

return str_replace('extends ', '', $extension);
},
$extensions
return array_reverse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the array_reverse? This will mess up the extending order which can be very problematic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it, I had no clue why I added it.

@theofidry
Copy link
Member

@reinfi looks like tests are failing. I guess that's what the array_reverse was for, but I don't think this would be the right solution as it would be a BC break.

@theofidry
Copy link
Member

You might want to rebase as well, no big change though :)

@theofidry
Copy link
Member

Closed via d1e88de. Thanks very much for this @reinfi :)

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

Successfully merging this pull request may close these issues.

2 participants