Skip to content

Commit 942f05f

Browse files
committed
minor #11498 fix code example for property info (OskarStark)
This PR was merged into the 3.4 branch. Discussion ---------- fix code example for property info <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- c146962 fix code example for property info
2 parents e071c9a + c146962 commit 942f05f

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

components/property_info.rst

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,35 +229,25 @@ This is based on how :doc:`PropertyAccess </components/property_access>` works,
229229
so it even looks for adder/remover methods and can transform between singular
230230
and plural property names::
231231

232+
use Acme\Entity\Analysis;
233+
232234
class SomeClass
233235
{
234236
private $analyses;
235-
private $feet;
236-
237-
public function addAnalyse(Dummy $analyse)
238-
{
239-
// ...
240-
}
241-
242-
public function removeAnalyse(Dummy $analyse)
243-
{
244-
// ...
245-
}
246237

247-
public function addFoot(Dummy $foot)
238+
public function addAnalysis(Analysis $analysis)
248239
{
249240
// ...
250241
}
251242

252-
public function removeFoot(Dummy $foot)
243+
public function removeAnalysis(Analysis $analysis)
253244
{
254245
// ...
255246
}
256247
}
257248

258249
// to be writable, both the adder and the remover methods must be defined
259250
$propertyInfo->isWritable(SomeClass::class, 'analyses'); // returns true
260-
$propertyInfo->isWritable(SomeClass::class, 'feet'); // returns true
261251

262252
.. versionadded:: 3.2
263253

0 commit comments

Comments
 (0)