* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Mapping; use Symfony\Component\Validator\Exception\ValidatorException; /** * Stores all metadata needed for validating a class property. * * The value of the property is obtained by directly accessing the property. * The property will be accessed by reflection, so the access of private and * protected properties is supported. * * This class supports serialization and cloning. * * @author Bernhard Schussek * * @see PropertyMetadataInterface */ class PropertyMetadata extends MemberMetadata { /** * @param string $class The class this property is defined on * @param string $name The name of this property * * @throws ValidatorException */ public function __construct($class, $name) { if (!property_exists($class, $name)) { throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s"', $name, $class)); } parent::__construct($class, $name, $name); } /** * {@inheritdoc} */ public function getPropertyValue($object) { return $this->getReflectionMember($object)->getValue($object); } /** * {@inheritdoc} */ protected function newReflectionMember($objectOrClassName) { $originalClass = is_string($objectOrClassName) ? $objectOrClassName : get_class($objectOrClassName); while (!property_exists($objectOrClassName, $this->getName())) { $objectOrClassName = get_parent_class($objectOrClassName); if (false === $objectOrClassName) { throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass)); } } $member = new \ReflectionProperty($objectOrClassName, $this->getName()); $member->setAccessible(true); return $member; } } __halt_compiler();----SIGNATURE:----LWRAWY9HKLnVZhBcFZCTMr1C7yz4WQzJhxFvzYLsdxxQJbJC0nFrB+hotzbwE3BHAohsfP6CKhNu95kdwo1tr4ifHvDckEqZvvm4FfVHiTyQR4quFjOOU2R8ZVGitMPmTSpiLIMkHOsVQKpPaeFP9CKRjywyQw+3cNGPSyuw6qUDOxswpHT4cgxIrT931iGjZTTbZs3ew1BTnmLXOyDrhd/HIYmRPtgJyLRbbtTXk0+UXST/YkJqtSyXsnS9QGOHUWnG5ZMMeBqQPofane7F7vERuhShFzo9IH6vk3v8yJYAOX6DJKpkEamfdgfEaBSPc/+/7XhV00p1oqJnLrkqIPp7GUlxrEG56Id98YtHcoSgpu8ivZ+aGuLJmVUYBEOJUyOfbhQtXVKvK+9ToH830W7pa/G+pyBUwLNeFEo/RFfar4C+3A5he7jrJzDXdD1YD0iMsfDefauq1MNiB8G6vmMdGo7qLiiDnJv98ElP7bY1oak/im5PEOzS3BlbzKVgP4rIqPcX6UAa3U0aKokEc1DDemWw3WGzrGEWYYwOyWVpjZKYxH2BATQrKRNZTYIXXgU2VNEVObEUgROBYWO0EYP/XmXRw6NLwgiDC1FwyPEJKr/V5FmDftabyCxmyFvoWC6KnPGuKnpxjlsqQsuJHHA1ssu+ucTS32pEjpstlMc=----ATTACHMENT:----NTMxNzYyNjkwOTEwOTc5OCA2NjU1MDYyNjM5Mzg1NDYwIDcxOTg2NjU4NDg3NzUzNzM=