Doctrine\OXM\Mapping\MappingException::customTypeWithoutNodeElement PHP Method

customTypeWithoutNodeElement() public static method

public static customTypeWithoutNodeElement ( $className, $fieldName )
    public static function customTypeWithoutNodeElement($className, $fieldName)
    {
        return new self("Custom types on field '{$fieldName}' of class '{$className}' can only be used with xml binding type '" . ClassMetadataInfo::XML_ELEMENT . "'");
    }

Usage Example

 /**
  * Complete and validate type mappings
  *
  * @param string $className
  * @param ClassMetadataInfo $class
  */
 private function completeMappingTypeValidation($className, ClassMetadataInfo $class)
 {
     foreach ($class->fieldMappings as $fieldName => $mapping) {
         if (Type::hasType($mapping['type'])) {
             continue;
         }
         // Support type as a mapped class?
         if (!$this->hasMetadataFor($mapping['type']) && !$this->getMetadataFor($mapping['type'])) {
             throw MappingException::fieldTypeNotFound($className, $fieldName, $mapping['type']);
         }
         // Mapped classes must have binding node type XML_ELEMENT
         if ($mapping['node'] !== ClassMetadataInfo::XML_ELEMENT) {
             throw MappingException::customTypeWithoutNodeElement($className, $fieldName);
         }
     }
 }