Beispiel #1
0
 /**
  * @param WriterHelper $writer
  * @param ClassMetadata $classMetadata
  * @param string $fieldName
  * @param mixed $fieldValue
  */
 private function _writeElement(WriterHelper $writer, ClassMetadata $classMetadata, $fieldName, $fieldValue)
 {
     $fieldType = $classMetadata->getTypeOfField($fieldName);
     if ($this->classMetadataFactory->hasMetadataFor($fieldType)) {
         if ($classMetadata->isCollection($fieldName)) {
             foreach ($fieldValue as $value) {
                 $this->doMarshal($value, $writer);
             }
         } else {
             $this->doMarshal($fieldValue, $writer);
         }
     }
 }
Beispiel #2
0
 /**
  * @param WriterHelper $writer
  * @param ClassMetadata $classMetadata
  * @param string $fieldName
  * @param mixed $fieldValue
  */
 private function writeElement(WriterHelper $writer, ClassMetadata $classMetadata, $fieldName, $fieldValue)
 {
     $fieldType = $classMetadata->getTypeOfField($fieldName);
     $mapping = $classMetadata->getFieldMapping($fieldName);
     $prefix = isset($mapping['prefix']) ? $mapping['prefix'] : null;
     if ($this->classMetadataFactory->hasMetadataFor($fieldType)) {
         if ($classMetadata->isCollection($fieldName)) {
             if ($classMetadata->hasFieldWrapping($fieldName)) {
                 $writer->startElement($mapping['wrapper'], $prefix);
             }
             foreach ($fieldValue as $value) {
                 $this->doMarshal($value, $writer);
             }
             if ($classMetadata->hasFieldWrapping($fieldName)) {
                 $writer->endElement();
             }
         } else {
             $this->doMarshal($fieldValue, $writer);
         }
     }
 }