* * 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:----ws7H0tHLfcq9QCrwYfUPPZHoNnS/xKt95Qf7kRIRPAVW5viVB1yEC64Ib+OvkMs/V1jG5dnhIskOwyp702wjT5m3rBqkTlOe/yLmebGfjh4/MsalaxNKalGDjfGUeEnCPRjUL+0vr2YRAvnHRZ4zfUgWqoGa43929EtSZeE3/2oE7vWbiTDMZ0033NCzjSeyHbeBcD15p+AzpBFKM47pV/Qw9BUjwt798MPr08vVtoM3pL30euYQCeGRarGJtO9eCXEWF3cbsf5FtjXa8Lr7/PED0V31HiUeBiRppVEUGuOoH95IimNwF4PUoiWvZloi1Ity0Unc7iXGnW3LIf5rL2c9AozpI8uHEONCyy0rL8fbFxpuLwviw5HuSTU0oP4BfSczpAzxVnsvcE/H3WbV6cjtZwhDO0hlbwfZh+SyYg6F/UCP+29Ax7eu4iwwV073zsgTFw7RdyWABnzol9gcadzNK16Om9fPS3I7GcMoT7Xxof6saQeb6qUVG5Q9Ithmq8It/ihORRLUF/eQk50465M4XoMPRTGXUY0YwNo6pCxb9J6v0KlLCstN/VfOHrsPK6lbQN1STQSj3duljwj0RVWNg9v/oikOXfg75YW6Jm/hkXgj0XDZTrGhv+FqIKGne1FiZLianY44ZM1Vgmn7DXMfm/+K4atq+/PNdfdjmWY=----ATTACHMENT:----MTg5MTEwMDUzMTE2OTI3MiAxMTgwNjY0OTk4MTg4NTc4IDY1NzI2MzYxMzA2MTI4NDk=