@@ -191,6 +191,8 @@ method::
191191 $value = $propertyAccessor->getValue($person, 'birthday');
192192
193193
194+ .. _components-property-access-magic-get :
195+
194196Magic ``__get() `` Method
195197~~~~~~~~~~~~~~~~~~~~~~~~
196198
@@ -213,6 +215,11 @@ The ``getValue()`` method can also use the magic ``__get()`` method::
213215
214216 var_dump($propertyAccessor->getValue($person, 'Wouter')); // [...]
215217
218+ .. versionadded :: 5.2
219+
220+ The magic `__get ` method can be disabled since in Symfony 5.2.
221+ see `Enable other Features `_.
222+
216223.. _components-property-access-magic-call :
217224
218225Magic ``__call() `` Method
@@ -273,6 +280,8 @@ also write to an array. This can be achieved using the
273280 // or
274281 // var_dump($person['first_name']); // 'Wouter'
275282
283+ .. _components-property-access-writing-to-objects :
284+
276285Writing to Objects
277286------------------
278287
@@ -351,6 +360,11 @@ see `Enable other Features`_::
351360
352361 var_dump($person->getWouter()); // [...]
353362
363+ .. versionadded :: 5.2
364+
365+ The magic `__set ` method can be disabled since in Symfony 5.2.
366+ see `Enable other Features `_.
367+
354368Writing to Array Properties
355369~~~~~~~~~~~~~~~~~~~~~~~~~~~
356370
@@ -461,14 +475,20 @@ configured to enable extra features. To do that you could use the
461475 // ...
462476 $propertyAccessorBuilder = PropertyAccess::createPropertyAccessorBuilder();
463477
464- // enables magic __call
465- $propertyAccessorBuilder->enableMagicCall();
478+ $propertyAccessorBuilder->enableMagicCall(); // enables magic __call
479+ $propertyAccessorBuilder->enableMagicGet(); // enables magic __get
480+ $propertyAccessorBuilder->enableMagicSet(); // enables magic __set
481+ $propertyAccessorBuilder->enableMagicMethods(); // enables magic __get, __set and __call
466482
467- // disables magic __call
468- $propertyAccessorBuilder->disableMagicCall();
483+ $propertyAccessorBuilder->disableMagicCall(); // enables magic __call
484+ $propertyAccessorBuilder->disableMagicGet(); // enables magic __get
485+ $propertyAccessorBuilder->disableMagicSet(); // enables magic __set
486+ $propertyAccessorBuilder->disableMagicMethods(); // enables magic __get, __set and __call
469487
470- // checks if magic __call handling is enabled
488+ // checks if magic __call, __get or __set handling are enabled
471489 $propertyAccessorBuilder->isMagicCallEnabled(); // true or false
490+ $propertyAccessorBuilder->isMagicGetEnabled(); // true or false
491+ $propertyAccessorBuilder->isMagicSetEnabled(); // true or false
472492
473493 // At the end get the configured property accessor
474494 $propertyAccessor = $propertyAccessorBuilder->getPropertyAccessor();
@@ -480,7 +500,7 @@ configured to enable extra features. To do that you could use the
480500
481501Or you can pass parameters directly to the constructor (not the recommended way)::
482502
483- // ...
484- $propertyAccessor = new PropertyAccessor(true); // this enables handling of magic __call
503+ // enable handling of magic __call, __set but not __get:
504+ $propertyAccessor = new PropertyAccessor(PropertyAccessor::MAGIC_CALL | PropertyAccessor::MAGIC_SET);
485505
486506.. _The Inflector component : https://github.com/symfony/inflector
0 commit comments