-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
UniqueObject Validators doesn't work if you give the column a different name, than the fields name. #377
Comments
This seems like a design flaw. @UFOMelkor do you think we can make the |
In my temporary solution, I grap the column name of the identifier fields. Have a look at: 2014-02-10 Marco Pivetta [email protected]
|
I don't like the 'columnName' index, as it is kind of a magic constant. But 2014-02-11 Dennis Dobslaf [email protected]
|
@DennisDobslaf doctrine deals with field names - column names are a low level problem that you shouldn't deal with, so that's absolutely the wrong fix/approach. |
Ok, understood this. I could change my 'user_id' into 'id', but that's not 2014-02-11 Marco Pivetta [email protected]
|
Sorry for the long delay, I was on holidays. @Ocramius |
I know where it is used, I just really dislike that approach :P |
:-D I'm fine with using One questions because I'm doing to much java and to less zf2 at the moment: For supporting Zend\Form we need the |
@UFOMelkor the other way would be to have a fieldset for multi-field values... But yes, |
Ok, I will look on this and send a PR :-) |
What about this approach(!) Usage is like $uniqueEmailValidator = new UniqueObject(array( |
I don't know why that PR is referencing this issue because not only does that PR not address this issue in any way, it also breaks BC as an added bonus. I still receive the Expected context to contain id exception whether or not I elect to The fallacy seems to be assuming that the entity's identifier field will be provided by the form. I'm sure this is possible if you're editing an existing entity but if you're adding a new entity with a unique field that is different from the identifier field then the identifier will not be available since it is auto-generated by the DB. |
UniqueObject Validators doesn't work if you give the column a different name, than the fields name.
So, if you have an user entity with id as identifier and name the column like 'user_id' (so, the webform also contains a field names 'user_id' the validator will fail at`
because, there is no 'id' (but 'user_id') in the form.
So, as renaming columns is a supported behaviour shouldn't the UniqueObject validator rely on the choosen/given columnName?
If have a working example here, but don't know, if it is correct in all ways...
Could make a pull request for that.
The text was updated successfully, but these errors were encountered: