Skip to content

Commit 24274f0

Browse files
committed
[#2130][2136] Proofreading the excellent new PropertyAccess component doc by @wouterj
1 parent f7a36ae commit 24274f0

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

components/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The Components
1818
http_kernel/index
1919
locale
2020
process
21+
property_access/index
2122
routing/index
2223
security/index
2324
serializer

components/map.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
* :doc:`/components/process`
7575

76-
* :doc:`/components/property_access/index
76+
* :doc:`/components/property_access/index`
7777

7878
* :doc:`/components/property_access/introduction`
7979

components/property_access/introduction.rst

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The PropertyAccess Component
66
============================
77

8-
PropertyAccess component provides function to read and write from/to an
8+
The PropertyAccess component provides function to read and write from/to an
99
object or array using a simple string notation.
1010

1111
.. versionadded:: 2.2
@@ -18,26 +18,26 @@ Installation
1818
You can install the component in two different ways:
1919

2020
* Use the official Git repository (https://github.com/symfony/PropertyAccess);
21-
* :doc:`Install it via Composer</components/using_components>` * (``symfony/property-access`` on `Packagist`_).
21+
* :doc:`Install it via Composer</components/using_components>` (``symfony/property-access`` on `Packagist`_).
2222

2323
Usage
2424
-----
2525

2626
The entry point of this component is the
27-
:method:`Symfony\\Component\\PropertyAccess\\PropertyAccess::getPropertyAccessor`
27+
:method:`PropertyAccess::getPropertyAccessor<Symfony\\Component\\PropertyAccess\\PropertyAccess::getPropertyAccessor>`
2828
factory. This factory will create a new instance of the
29-
:class:`Symfony\\Component\\PropertyAccess\PropertyAccessor` class with the
29+
:class:`Symfony\\Component\\PropertyAccess\\PropertyAccessor` class with the
3030
default configuration::
3131

3232
use Symfony\Component\PropertyAccess\PropertyAccess;
3333

34-
$accessor = PropertyAccess:getPropertyAccessor();
34+
$accessor = PropertyAccess::getPropertyAccessor();
3535

36-
Reading from arrays
36+
Reading from Arrays
3737
-------------------
3838

3939
You can read an array with the
40-
:method:`Symfony\\Component\\PropertyAccess\PropertyAccessor::getValue`
40+
:method:`PropertyAccessor::getValue<Symfony\\Component\\PropertyAccess\\PropertyAccessor::getValue>`
4141
method. This is done using the index notation that is used in PHP::
4242

4343
// ...
@@ -65,37 +65,37 @@ You can also use multi dimensional arrays::
6565
echo $accessor->getValue($persons, '[0][first_name]'); // 'Wouter'
6666
echo $accessor->getValue($persons, '[1][first_name]'); // 'Ryan'
6767

68-
Reading from objects
68+
Reading from Objects
6969
--------------------
7070

71-
The ``getValue`` method is a very robust method. You can see all features if
72-
you are working with objects.
71+
The ``getValue`` method is a very robust method, and you can see all of its
72+
features when working with objects.
7373

74-
Using properties
75-
~~~~~~~~~~~~~~~~
74+
Accessing public Properties
75+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
7676

77-
We can read properties without the index notation, instead we use the dot
78-
notation::
77+
To read from properties, use the "dot" notation::
7978

8079
// ...
8180
$person = new Person();
8281
$person->firstName = 'Wouter';
8382

84-
echo $accessor->getValue($person, 'first_name'); // 'Wouter'
83+
echo $accessor->getValue($person, 'firstName'); // 'Wouter'
8584

8685
$child = new Person();
8786
$child->firstName = 'Bar';
8887
$person->children = array($child);
8988

90-
echo $accessor->getValue($person, 'children[0].first_name'); // 'Bar'
89+
echo $accessor->getValue($person, 'children[0].firstName'); // 'Bar'
9190

9291
.. caution::
9392

94-
This option is the last option used by the ``PropertyAccessor``. It tries
95-
to find the other options before using the property. If you have a public
96-
property that have a getter to, it will use the getter.
93+
Accessing public properties is the last option used by ``PropertyAccessor``.
94+
It tries to access the value using the below methods first before using
95+
the property directly. For example, if you have a public property that
96+
has a getter method, it will use the getter.
9797

98-
Using getters
98+
Using Getters
9999
~~~~~~~~~~~~~
100100

101101
The ``getValue`` method also supports reading using getters. The method will
@@ -118,11 +118,11 @@ property name (``first_name`` becomes ``FirstName``) and prefixes it with
118118

119119
echo $accessor->getValue($person, 'first_name'); // 'Wouter'
120120

121-
Using hassers/issers
121+
Using Hassers/Issers
122122
~~~~~~~~~~~~~~~~~~~~
123123

124124
And it doesn't even stop there. If there is no getter found, the accessor will
125-
look for a isser or hasser. This method is created using the same way as
125+
look for an isser or hasser. This method is created using the same way as
126126
getters, this means that you can do something like this::
127127

128128
// ...
@@ -156,7 +156,7 @@ This will produce: ``He is an author``
156156
Magic Methods
157157
~~~~~~~~~~~~~
158158

159-
At last, the ``getValue`` can use the magic ``__get`` too::
159+
At last, ``getValue`` can use the magic ``__get`` method too::
160160

161161
// ...
162162
class Person
@@ -175,12 +175,12 @@ At last, the ``getValue`` can use the magic ``__get`` too::
175175

176176
echo $accessor->getValue($person, 'Wouter'); // array(...)
177177

178-
Writing to arrays
178+
Writing to Arrays
179179
-----------------
180180

181-
The ``PropertyAccessor`` class can do more than just reading an array, it can
181+
The ``PropertyAccessor`` class can do more than just read an array, it can
182182
also write to an array. This can be achieved using the
183-
:method:`Symfony\\Component\\PropertyAccess\\PropertyAccessor::setValue`
183+
:method:`PropertyAccessor::setValue<Symfony\\Component\\PropertyAccess\\PropertyAccessor::setValue>`
184184
method::
185185

186186
// ...
@@ -192,7 +192,7 @@ method::
192192
// or
193193
// echo $person['first_name']; // 'Wouter'
194194

195-
Writing to objects
195+
Writing to Objects
196196
------------------
197197

198198
The ``setValue`` method has the same features as the ``getValue`` method. You
@@ -228,7 +228,7 @@ can use setters, the magic ``__set`` or properties to set values::
228228
echo $person->getLastName(); // 'de Jong'
229229
echo $person->children; // array(Person());
230230

231-
Mixing objects and arrays
231+
Mixing Objects and Arrays
232232
-------------------------
233233

234234
You can also mix objects and arrays::

0 commit comments

Comments
 (0)