Doctrine\ODM\PHPCR\Mapping\ClassMetadata::getFieldMapping PHP Method

getFieldMapping() public method

Gets the mapping of a (regular) field that holds some data but not a reference to another object.
public getFieldMapping ( string $fieldName ) : array
$fieldName string The field name.
return array The field mapping.
    public function getFieldMapping($fieldName)
    {
        if (!$this->hasField($fieldName)) {
            throw MappingException::fieldNotFound($this->name, $fieldName);
        }
        return $this->mappings[$fieldName];
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Assertion shortcut:
  * Check the given $metadata contain a field mapping for $field that contains the $key and having the value $expectedValue.
  * @param $expectedValue The expected value
  * @param \Doctrine\ODM\PHPCR\Mapping\ClassMetadata $metadata The class metadata to test
  * @param $field The name of the field's mapping to test
  * @param $key The key expected to be in the field mapping
  */
 protected function assertFieldMetadataEquals($expectedValue, ClassMetadata $metadata, $field, $key)
 {
     $mapping = $metadata->getFieldMapping($field);
     $this->assertInternalType('array', $mapping);
     $this->assertTrue(array_key_exists($key, $mapping));
     $this->assertEquals($expectedValue, $mapping[$key]);
 }
All Usage Examples Of Doctrine\ODM\PHPCR\Mapping\ClassMetadata::getFieldMapping
ClassMetadata