File tree 1 file changed +38
-2
lines changed 1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -237,8 +237,44 @@ provide whether properties are readable or writable as booleans.
237
237
238
238
The :class: `Symfony\\ Component\\ PropertyInfo\\ Extractor\\ ReflectionExtractor ` looks
239
239
for getter/isser/setter method in addition to whether or not a property is public
240
- to determine if it's accessible. This based on how the :doc: `PropertyAccess </components/property_access >`
241
- works.
240
+ to determine if it's accessible.
241
+
242
+ This is based on how :doc: `PropertyAccess </components/property_access >` works,
243
+ so it even looks for in adder/remover methods and can transform between singular
244
+ and plural property names::
245
+
246
+ class SomeClass
247
+ {
248
+ private $analyses;
249
+ private $feet;
250
+
251
+ public function addAnalyse(Dummy $analyse)
252
+ {
253
+ // ...
254
+ }
255
+
256
+ public function removeAnalyse(Dummy $analyse)
257
+ {
258
+ // ...
259
+ }
260
+
261
+ public function addFoot(Dummy $foot)
262
+ {
263
+ // ...
264
+ }
265
+
266
+ public function removeFoot(Dummy $foot)
267
+ {
268
+ // ...
269
+ }
270
+ }
271
+
272
+ // to be writable, both the adder and the remover methods must be defined
273
+ $propertyInfo->isWritable(SomeClass::class, 'analyses'); // returns true
274
+ $propertyInfo->isWritable(SomeClass::class, 'feet'); // returns true
275
+
276
+ .. versionadded :: 3.2
277
+ The support of adder/remover methods was introduced in Symfony 3.2.
242
278
243
279
.. tip ::
244
280
You can’t perform that action at this time.
0 commit comments