-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Added documentation for the new PropertyAccessor::isReadable() and isWritable() methods #3729
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,6 +309,39 @@ see `Enable other Features`_. | |
|
||
echo $person->getWouter(); // array(...) | ||
|
||
Checking Property Paths | ||
----------------------- | ||
|
||
.. versionadded:: 2.5 | ||
The methods | ||
:method:`PropertyAccessor::isReadable<Symfony\\Component\\PropertyAccess\\PropertyAccessor::isReadable>` | ||
and | ||
:method:`PropertyAccessor::isWritable<Symfony\\Component\\PropertyAccess\\PropertyAccessor::isWritable>` | ||
methods were added in Symfony 2.5. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [...] were introduced in Symfony 2.5 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's our standard :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we need to follow the exact same sentence structure and wording whenever we describe a new feature? Sounds very technical to me. :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not exactly the same sentence, but it's nice to be consistent in how to say something was new in a specific version. Otherwise you get an inconsistent mix of "are introduced in", "added in", "new in", "since", ... The biggest problem is that you get some directives using the past, somw using the future, some the present, etc. If all versions used the same tense, it wouldn't be a peoblem |
||
|
||
When you want to check whether :method:`PropertyAccessor::getValue<Symfony\\Component\\PropertyAccess\\PropertyAccessor::getValue>` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should move the |
||
can safely be called without actually calling that method, you can use | ||
:method:`PropertyAccessor::isReadable<Symfony\\Component\\PropertyAccess\\PropertyAccessor::isReadable>` | ||
instead:: | ||
|
||
$person = new Person(); | ||
|
||
if ($accessor->isReadable($person, 'firstName') { | ||
// ... | ||
} | ||
|
||
The same is possible for :method:`PropertyAccessor::setValue<Symfony\\Component\\PropertyAccess\\PropertyAccessor::setValue>`: | ||
Call the | ||
:method:`PropertyAccessor::isWritable<Symfony\\Component\\PropertyAccess\\PropertyAccessor::isWritable>` | ||
method to find out whether a property path can be updated. In the third | ||
argument, you should pass the value that you want to write:: | ||
|
||
$person = new Person(); | ||
|
||
if ($accessor->isWritable($person, 'firstName', 'Wouter') { | ||
// ... | ||
} | ||
|
||
Mixing Objects and Arrays | ||
------------------------- | ||
|
||
|
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.
there should be a space before
<
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.
Really? There is no space before
<
in the rest of the document either.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 thought I had done a PR to do that. And yes, the restructured specification states that there should be a spacd before the <> block
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.
Ok, I'll update all method links in this document.
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 think you should update it only in the new text in this PR. Updating the existing ones should be done in the 2.3 branch to have the fix in all maintained branches (to avoid conflicts when merging branches together)