/** * Load all of the @XmlValue annotations * * @param ClassMetadata $metadata */ protected function loadClassValue(ClassMetadata $metadata) { $reflClass = $metadata->getReflectionClass(); foreach ($reflClass->getProperties() as $property) { foreach ($this->reader->getPropertyAnnotations($property) as $annotation) { if ($annotation instanceof XmlValue) { $metadata->setValue($property->getName()); } } } }
/** * Parse the value from a SimpleXml node * * @param SimpleXmlElement $xml * @param ClassMetadata $metadata * @param stdClass $obj */ protected function parseValue(\SimpleXmlElement $xml, ClassMetadata $metadata, $obj) { if (!is_null($metadata->getValue())) { $setter = 'set' . ucfirst($metadata->getValue()); $value = (string) $xml; $obj->{$setter}($value); } }