-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Use concrete Class Methods to check validations #7271
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
Conversation
Please use the concrete Class Methods to check validations. Its realy unexpected that Validator don't use the normal Object way and can call anything...
@jfsimon Do you have a response about my comment in the original PR ? At least we now have a BC break (ie new is no more called). |
@vicb I didn't saw it. I update the description. |
np, do you have a reply ? BCB = yes should trigger a note in the changelog |
@vicb a response about the |
Yep "Jean-François Simon" [email protected] wrote:
|
@vicb |
@vicb @Gladhon correct me if I'm wrong. This method is only used to check the member scope. In the case of a getter, this scope is always public ( |
Yes i am in agreement with that. But I just think about to change the getPropertyValue also in PropertyMetadata. Can that make sense in any case ? |
@jfsimon My question is whether it would make sense to change the signature of Finally |
Well, i like it how it is now. Cause if we change that, you also need to have a object if calling "isPublic". For me it makes more sence to have only the object parameter if its realy needed. |
@vicb I think passing object instance to |
|
||
public function getOverriddenData() | ||
{ | ||
return 'Non overridden data'; |
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.
then getData
is probably a better name ?
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.
it would be, yes.
[Validator] added overridden getter metadata test [Validator] class member reflection build requires object instance [Validator] fixed error [Validation] fixed member metadata reflection cache [Validation] added property metedata test [Validation] fixed class/member metadata mapping [Validation] removed var_dump
This PR was merged into the master branch. Commits ------- b6a5457 [Validator] Fixed member (getter/property) metadata readers. [Validator] added overridden getter metadata test [Validator] class member reflection build requires object instance [Validator] fixed error [Validation] fixed member metadata reflection cache [Validation] added property metedata test [Validation] fixed class/member metadata mapping [Validation] removed var_dump 9b6cd80 Update src/Symfony/Component/Validator/Mapping/GetterMetadata.php Discussion ---------- [Validator] Use concrete Class Methods to check validations This PR just adds a test to #7069. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7069 --------------------------------------------------------------------------- by vicb at 2013-03-05T18:21:02Z @jfsimon Do you have a response about my comment in the original PR ? At least we now have a BC break (ie new is no more called). --------------------------------------------------------------------------- by jfsimon at 2013-03-05T18:30:43Z @vicb I didn't saw it. I update the description. --------------------------------------------------------------------------- by vicb at 2013-03-05T18:34:01Z np, do you have a reply ? _BCB = yes should trigger a note in the changelog_ --------------------------------------------------------------------------- by jfsimon at 2013-03-05T18:51:15Z @vicb a response about the `newReflectionMember` method update? --------------------------------------------------------------------------- by vicb at 2013-03-05T19:08:54Z Yep "Jean-François Simon" <[email protected]> wrote: >@vicb a response about the `newReflectionMember` method update? > >--- >Reply to this email directly or view it on GitHub: >#7271 (comment) --------------------------------------------------------------------------- by Gladhon at 2013-03-06T08:04:38Z @vicb newReflectionMember is a Method that comes from the parent and has no argument "object". So it can only get the reflection Member of the configured class, while we need once (in this special case) need the method of the concrete class. --------------------------------------------------------------------------- by jfsimon at 2013-03-06T08:29:11Z @vicb @Gladhon correct me if I'm wrong. This method is only used to check the member scope. In the case of a getter, this scope is always public (`method_exists` returns true only if method is visible, then is this case public, isn'it?), so the `isPublic`, `isProtected` and `isPrivate` methods can be safely overriden. Am I right? --------------------------------------------------------------------------- by Gladhon at 2013-03-06T08:43:54Z Yes i am in agreement with that. But I just think about to change the getPropertyValue also in PropertyMetadata. Can that make sense in any case ? --------------------------------------------------------------------------- by vicb at 2013-03-06T08:56:21Z @jfsimon `method_exists` returns `true` when the method exists, whatever its visibility. My question is whether it would make sense to change the signature of `newReflectionMember` to accept an objet ? That would be a BC break but the implementation proposed here is also a BC break (`newReflectionMember` which was called from `getReflectionMember` is no more called with this PR - it could have been overriden by a dev) Finally `PropertyMetadata` should probably be updated in the same way. --------------------------------------------------------------------------- by vicb at 2013-03-06T08:57:33Z _and fyi you can both work on the same PR, ie @Gladhon you can send some changes (a PR) to the repo of @jfsimon_ --------------------------------------------------------------------------- by Gladhon at 2013-03-06T10:22:07Z Well, i like it how it is now. Cause if we change that, you also need to have a object if calling "isPublic". For me it makes more sence to have only the object parameter if its realy needed. Where do you see a real benefit if we change the `newReflectionMember` instead ? --------------------------------------------------------------------------- by jfsimon at 2013-03-07T13:43:43Z @vicb I think passing object instance to `getReflectionMember` is **required** for consistency. I just pushed it.
This PR was merged into the master branch. Commits ------- b6a5457 [Validator] Fixed member (getter/property) metadata readers. [Validator] added overridden getter metadata test [Validator] class member reflection build requires object instance [Validator] fixed error [Validation] fixed member metadata reflection cache [Validation] added property metedata test [Validation] fixed class/member metadata mapping [Validation] removed var_dump 9b6cd80 Update src/Symfony/Component/Validator/Mapping/GetterMetadata.php Discussion ---------- [Validator] Use concrete Class Methods to check validations This PR just adds a test to #7069. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7069 --------------------------------------------------------------------------- by vicb at 2013-03-05T18:21:02Z @jfsimon Do you have a response about my comment in the original PR ? At least we now have a BC break (ie new is no more called). --------------------------------------------------------------------------- by jfsimon at 2013-03-05T18:30:43Z @vicb I didn't saw it. I update the description. --------------------------------------------------------------------------- by vicb at 2013-03-05T18:34:01Z np, do you have a reply ? _BCB = yes should trigger a note in the changelog_ --------------------------------------------------------------------------- by jfsimon at 2013-03-05T18:51:15Z @vicb a response about the `newReflectionMember` method update? --------------------------------------------------------------------------- by vicb at 2013-03-05T19:08:54Z Yep "Jean-François Simon" <[email protected]> wrote: >@vicb a response about the `newReflectionMember` method update? > >--- >Reply to this email directly or view it on GitHub: >symfony/symfony#7271 (comment) --------------------------------------------------------------------------- by Gladhon at 2013-03-06T08:04:38Z @vicb newReflectionMember is a Method that comes from the parent and has no argument "object". So it can only get the reflection Member of the configured class, while we need once (in this special case) need the method of the concrete class. --------------------------------------------------------------------------- by jfsimon at 2013-03-06T08:29:11Z @vicb @Gladhon correct me if I'm wrong. This method is only used to check the member scope. In the case of a getter, this scope is always public (`method_exists` returns true only if method is visible, then is this case public, isn'it?), so the `isPublic`, `isProtected` and `isPrivate` methods can be safely overriden. Am I right? --------------------------------------------------------------------------- by Gladhon at 2013-03-06T08:43:54Z Yes i am in agreement with that. But I just think about to change the getPropertyValue also in PropertyMetadata. Can that make sense in any case ? --------------------------------------------------------------------------- by vicb at 2013-03-06T08:56:21Z @jfsimon `method_exists` returns `true` when the method exists, whatever its visibility. My question is whether it would make sense to change the signature of `newReflectionMember` to accept an objet ? That would be a BC break but the implementation proposed here is also a BC break (`newReflectionMember` which was called from `getReflectionMember` is no more called with this PR - it could have been overriden by a dev) Finally `PropertyMetadata` should probably be updated in the same way. --------------------------------------------------------------------------- by vicb at 2013-03-06T08:57:33Z _and fyi you can both work on the same PR, ie @Gladhon you can send some changes (a PR) to the repo of @jfsimon_ --------------------------------------------------------------------------- by Gladhon at 2013-03-06T10:22:07Z Well, i like it how it is now. Cause if we change that, you also need to have a object if calling "isPublic". For me it makes more sence to have only the object parameter if its realy needed. Where do you see a real benefit if we change the `newReflectionMember` instead ? --------------------------------------------------------------------------- by jfsimon at 2013-03-07T13:43:43Z @vicb I think passing object instance to `getReflectionMember` is **required** for consistency. I just pushed it.
This PR was merged into the master branch. Commits ------- b6a5457 [Validator] Fixed member (getter/property) metadata readers. [Validator] added overridden getter metadata test [Validator] class member reflection build requires object instance [Validator] fixed error [Validation] fixed member metadata reflection cache [Validation] added property metedata test [Validation] fixed class/member metadata mapping [Validation] removed var_dump 9b6cd80 Update src/Symfony/Component/Validator/Mapping/GetterMetadata.php Discussion ---------- [Validator] Use concrete Class Methods to check validations This PR just adds a test to #7069. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7069 --------------------------------------------------------------------------- by vicb at 2013-03-05T18:21:02Z @jfsimon Do you have a response about my comment in the original PR ? At least we now have a BC break (ie new is no more called). --------------------------------------------------------------------------- by jfsimon at 2013-03-05T18:30:43Z @vicb I didn't saw it. I update the description. --------------------------------------------------------------------------- by vicb at 2013-03-05T18:34:01Z np, do you have a reply ? _BCB = yes should trigger a note in the changelog_ --------------------------------------------------------------------------- by jfsimon at 2013-03-05T18:51:15Z @vicb a response about the `newReflectionMember` method update? --------------------------------------------------------------------------- by vicb at 2013-03-05T19:08:54Z Yep "Jean-François Simon" <[email protected]> wrote: >@vicb a response about the `newReflectionMember` method update? > >--- >Reply to this email directly or view it on GitHub: >symfony/symfony#7271 (comment) --------------------------------------------------------------------------- by Gladhon at 2013-03-06T08:04:38Z @vicb newReflectionMember is a Method that comes from the parent and has no argument "object". So it can only get the reflection Member of the configured class, while we need once (in this special case) need the method of the concrete class. --------------------------------------------------------------------------- by jfsimon at 2013-03-06T08:29:11Z @vicb @Gladhon correct me if I'm wrong. This method is only used to check the member scope. In the case of a getter, this scope is always public (`method_exists` returns true only if method is visible, then is this case public, isn'it?), so the `isPublic`, `isProtected` and `isPrivate` methods can be safely overriden. Am I right? --------------------------------------------------------------------------- by Gladhon at 2013-03-06T08:43:54Z Yes i am in agreement with that. But I just think about to change the getPropertyValue also in PropertyMetadata. Can that make sense in any case ? --------------------------------------------------------------------------- by vicb at 2013-03-06T08:56:21Z @jfsimon `method_exists` returns `true` when the method exists, whatever its visibility. My question is whether it would make sense to change the signature of `newReflectionMember` to accept an objet ? That would be a BC break but the implementation proposed here is also a BC break (`newReflectionMember` which was called from `getReflectionMember` is no more called with this PR - it could have been overriden by a dev) Finally `PropertyMetadata` should probably be updated in the same way. --------------------------------------------------------------------------- by vicb at 2013-03-06T08:57:33Z _and fyi you can both work on the same PR, ie @Gladhon you can send some changes (a PR) to the repo of @jfsimon_ --------------------------------------------------------------------------- by Gladhon at 2013-03-06T10:22:07Z Well, i like it how it is now. Cause if we change that, you also need to have a object if calling "isPublic". For me it makes more sence to have only the object parameter if its realy needed. Where do you see a real benefit if we change the `newReflectionMember` instead ? --------------------------------------------------------------------------- by jfsimon at 2013-03-07T13:43:43Z @vicb I think passing object instance to `getReflectionMember` is **required** for consistency. I just pushed it.
This PR just adds a test to #7069.