8000 Add documentation for the use of __call with propertyAccess by jaugustin · Pull Request #2472 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

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

Closed

Conversation

jaugustin
Copy link
Contributor

This is modification is for a pending pull request on symfony/symfony#7263

8000
@@ -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::
Copy link
Member

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

@jaugustin
Copy link
Contributor Author

@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>`::
Copy link
Member

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.

@jaugustin
Copy link
Contributor Author

PR updated to reflect changes on the PropertyAccess


At last, ``getValue`` can use the magic ``__get`` method too::
the ``getValue`` method can also use the magic ``__get`` method::
Copy link
Member

Choose a reason for hiding this comment

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

The (capitalized

@wouterj
Copy link
Member
wouterj commented Apr 27, 2013

What about creating a new section at the bottom of the article called Enable other Features where you explain the use of the builder and how to enable magic call methods?

Then, you can link to it from the Magic __call() Method sections.

@jaugustin
Copy link
Contributor Author

@wouterj ok I will write it

@weaverryan
Copy link
Member

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!

@jaugustin
Copy link
Contributor Author

@weaverryan I will finish it by the end of this week

@jaugustin
Copy link
Contributor Author

@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)::
Copy link
Member

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

@wouterj
Copy link
Member
wouterj commented May 8, 2013

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.

@jaugustin
Copy link
Contributor Author

@wouterj fixed

@wouterj
Copy link
Member
wouterj commented May 8, 2013

👍

@weaverryan
Copy link
Member

Thanks guys! I've patched this into the 2.3 branch at sha: b140d5c

@weaverryan weaverryan closed this May 26, 2013
@jaugustin jaugustin deleted the propertyaccess-support-magic-call branch May 26, 2013 16:55
ondrejmirtes pushed a commit to ondrejmirtes/symfony that referenced this pull request Nov 25, 2013
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
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.

5 participants
0