You are here

public function ExecutionContextInterface::getPropertyPath in Plug 7

Returns the property path to the value that the validator is currently validating.

For example, take the following object graph:

<pre> (Person)---($address: Address)---($street: string) </pre>

When the <tt>Person</tt> instance is passed to the validator, the property path is initially empty. When the <tt>$address</tt> property of that person is validated, the property path is "address". When the <tt>$street</tt> property of the related <tt>Address</tt> instance is validated, the property path is "address.street".

Properties of objects are prefixed with a dot in the property path. Indices of arrays or objects implementing the {@link \ArrayAccess} interface are enclosed in brackets. For example, if the property in the previous example is <tt>$addresses</tt> and contains an array of <tt>Address</tt> instance, the property path generated for the <tt>$street</tt> property of one of these addresses is for example "addresses[0].street".

Parameters

string $subPath Optional. The suffix appended to the current: property path.

Return value

string The current property path. The result may be an empty string if the validator is currently validating the root value of the validation graph.

2 methods override ExecutionContextInterface::getPropertyPath()
ExecutionContext::getPropertyPath in lib/Symfony/validator/Symfony/Component/Validator/ExecutionContext.php
Returns the property path to the value that the validator is currently validating.
ExecutionContext::getPropertyPath in lib/Symfony/validator/Symfony/Component/Validator/Context/ExecutionContext.php
Returns the property path to the value that the validator is currently validating.

File

lib/Symfony/validator/Symfony/Component/Validator/ExecutionContextInterface.php, line 326

Class

ExecutionContextInterface
Stores the validator's state during validation.

Namespace

Symfony\Component\Validator

Code

public function getPropertyPath($subPath = '');