-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add documentation for the use of __call with propertyAccess #2472
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
Add documentation for the use of __call with propertyAccess #2472
Conversation
@@ -156,7 +156,7 @@ This will produce: ``He is an author`` | |||
Magic Methods | |||
~~~~~~~~~~~~~ | |||
|
|||
At last, ``getValue`` can use the magic ``__get`` method too:: | |||
The, ``getValue`` can use the magic ``__get`` method too:: |
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.
you should remove The,
. the sentence is wrong currently
@wouterj I fixed it |
@@ -175,6 +175,42 @@ At last, ``getValue`` can use the magic ``__get`` method too:: | |||
|
|||
echo $accessor->getValue($person, 'Wouter'); // array(...) | |||
|
|||
|
|||
At last, ``getValue`` can use the magic ``__call`` method, but you need to | |||
enable this feature by calling :method:`PropertyAccessor::enableMagicCall<Symfony\\Component\\PropertyAccess\\PropertyAccessor::enableMagicCall>`:: |
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.
I don't think it is usefull to include the classname here. Just only give the path to the method. Also, please add a linebreak before it, so we don't break or 72th character rule.
PR updated to reflect changes on the |
|
||
At last, ``getValue`` can use the magic ``__get`` method too:: | ||
the ``getValue`` method can also use the magic ``__get`` method:: |
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.
The
(capitalized
What about creating a new section at the bottom of the article called Then, you can link to it from the |
@wouterj ok I will write it |
Ping @jaugustin! Are we close on this? Can/should we merge this in and add other details later? I haven't proofed it yet - ideally we can get it all done then get it all merged in at once. Thanks! |
@weaverryan I will finish it by the end of this week |
@weaverryan @wouterj I updated the doc, it should be good now ;) |
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
The :class:`Symfony\\Component\\PropertyAccess\\PropertyAccessor` can be configured to enable extra features. | ||
You can pass parameters directly to the constructor (not the recommended way):: |
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.
you should wrap the line around the 75th character
Thank you! I left some comments. One thing I didn't say is that I prefer to have the recommend way before the other one. |
@wouterj fixed |
👍 |
Thanks guys! I've patched this into the 2.3 branch at sha: b140d5c |
This PR was merged into the master branch. Discussion ---------- [PropertyAccess] add support for magic call Hi, I add support for magic call with the `PropertyAccess` the is basic implementation, if no `getter`, `isser`, or `hasser` or `_get` is found and there is `__call` then the PropertyAccess call the getter the same for setter. This functionality is disable by default | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | seems OK (failure/errors are the same on master) | Fixed tickets | symfony#4683, symfony#6413, symfony#5309 | License | MIT | Doc PR | symfony/symfony-docs#2472 - [x] submit changes to the documentation @bschussek is this ok ? Commits ------- a785baa [PropertyAccess] add support for magic call, related to symfony#4683
This is modification is for a pending pull request on symfony/symfony#7263