File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -66,14 +66,15 @@ You can use ``#[HasNamedArguments]`` to make some constraint options required::
6666 }
6767 }
6868
69- Constraint with private properties
69+ Constraint with Private Properties
7070~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7171
72- Constraints are cached for efficiency, but private properties are not supported
73- by default.
72+ Constraints are cached for performance reasons. To achieve this, the base
73+ ``Constraint `` class uses PHP's :phpfunction: `get_object_vars() ` function, which
74+ excludes private properties of child classes.
7475
75- So if you're using private properties in your constraint , you must override default
76- ``__sleep `` method ::
76+ If your constraint defines private properties, you must explicitly include them
77+ in the ``__sleep() `` method to ensure they are serialized correctly ::
7778
7879 // src/Validator/ContainsAlphanumeric.php
7980 namespace App\Validator;
You can’t perform that action at this time.
0 commit comments