Skip to content

fix code example for property info #11498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions components/property_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,35 +229,25 @@ This is based on how :doc:`PropertyAccess </components/property_access>` works,
so it even looks for adder/remover methods and can transform between singular
and plural property names::

use Acme\Entity\Analysis;

class SomeClass
{
private $analyses;
private $feet;

public function addAnalyse(Dummy $analyse)
{
// ...
}

public function removeAnalyse(Dummy $analyse)
{
// ...
}

public function addFoot(Dummy $foot)
public function addAnalysis(Analysis $analysis)
{
// ...
}

public function removeFoot(Dummy $foot)
public function removeAnalysis(Analysis $analysis)
{
// ...
}
}

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

.. versionadded:: 3.2

Expand Down