Checks whether a field is part of the identifier/primary key field(s).
public isIdentifier ( string $fieldName ) : boolean | ||
$fieldName | string | The field name |
return | boolean | TRUE if the field is part of the table identifier/primary key field(s), FALSE otherwise. |
/** * @test */ public function itShouldIdentifyIdentifiers() { $class = new ClassMetadataInfo('Doctrine\\Tests\\OXM\\Mapping\\Entity'); $class->mapField(array('fieldName' => 'squibble', 'type' => 'string', 'id' => true)); $this->assertEquals('squibble', $class->identifier); $this->assertEquals('squibble', $class->getIdentifier()); $this->assertTrue($class->isIdentifier('squibble')); $this->assertFalse($class->isIdentifier('not_squibble')); }