Doctrine\Search\Mapping\ClassMetadata::getTypeOfField PHP Method

getTypeOfField() public method

This type names can be implementation specific but should at least include the php types: integer, string, boolean, float/double, datetime.
public getTypeOfField ( string $fieldName ) : string
$fieldName string
return string
    public function getTypeOfField($fieldName)
    {
        //@todo: check if $field exists
        return $this->fieldMappings[$fieldName]['type'];
    }

Usage Example

Example #1
0
 public function testGetTypeOfField()
 {
     $this->assertEquals('string', $this->classMetadata->getTypeOfField('className'));
     $this->assertEquals('integer', $this->classMetadata->getTypeOfField('numberOfShards'));
     $this->assertEquals('array', $this->classMetadata->getTypeOfField('fieldMappings'));
 }