hasMetadataFor() public method

Checks whether the factory has the metadata for a class loaded already.
public hasMetadataFor ( string $className ) : boolean
$className string
return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise.
 /**
  * @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, $mapping);
             }
             if ($classMetadata->hasFieldWrapping($fieldName)) {
                 $writer->endElement();
             }
         } else {
             $this->doMarshal($fieldValue, $writer, $mapping);
         }
     } else {
         if ($this->allowUnknownElements) {
             $this->doMarshal($fieldValue, $writer, $mapping);
         }
     }
 }
Exemplo n.º 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);
     if ($this->classMetadataFactory->hasMetadataFor($fieldType)) {
         if ($classMetadata->isCollection($fieldName)) {
             foreach ($fieldValue as $value) {
                 $this->doMarshal($value, $writer);
             }
         } else {
             $this->doMarshal($fieldValue, $writer);
         }
     }
 }