File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -190,12 +190,50 @@ The configured property will be used via its implemented getter/setter methods b
190190 return $this->currentPlace;
191191 }
192192
193- public function setCurrentPlace($currentPlace, $context = []): void
193+ public function setCurrentPlace(string $currentPlace, array $context = []): void
194194 {
195195 $this->currentPlace = $currentPlace;
196196 }
197197 }
198198
199+ .. tip ::
200+
201+ It is also possible to use public properties to be used by the marking
202+ store. The above class would become the following::
203+
204+ // src/Entity/BlogPost.php
205+ namespace App\Entity;
206+
207+ class BlogPost
208+ {
209+ // the configured marking store property must be declared
210+ public string $currentPlace;
211+ public string $title;
212+ public string $content;
213+ }
214+
215+ When using public properties, context is not supported. In order
216+ to support it, you must declare a setter to write your property::
217+
218+ // src/Entity/BlogPost.php
219+ namespace App\Entity;
220+
221+ class BlogPost
222+ {
223+ public string $currentPlace;
224+ // ...
225+
226+ public function setCurrentPlace(string $currentPlace, array $context = []): void
227+ {
228+ // Assign the property and so something with `$context`
229+ }
230+ }
231+
232+ .. versionadded :: 6.4
233+
234+ The support of using public properties instead of getter/setter methods
235+ and private properties was introduced in Symfony 6.4.
236+
199237.. note ::
200238
201239 The marking store type could be "multiple_state" or "single_state". A single
You can’t perform that action at this time.
0 commit comments