|
@@ 965-983 (lines=19) @@
|
| 962 |
|
* @expectedException \Doctrine\ORM\Mapping\MappingException |
| 963 |
|
* @expectedExceptionMessage Entity 'Doctrine\Tests\Models\ValueGenerators\DummyWithThreeProperties' has a composite identifier with with an Identity strategy. This is not supported. |
| 964 |
|
*/ |
| 965 |
|
public function testCompositeIdentifierWithIdentityValueGenerator() : void |
| 966 |
|
{ |
| 967 |
|
$classMetadata = new ClassMetadata(DummyWithThreeProperties::class, $this->metadataBuildingContext); |
| 968 |
|
$classMetadata->setTable(new Mapping\TableMetadata()); |
| 969 |
|
|
| 970 |
|
$fooMetadata = new Mapping\FieldMetadata('a'); |
| 971 |
|
$fooMetadata->setType(Type::getType(Type::INTEGER)); |
| 972 |
|
$fooMetadata->setPrimaryKey(true); |
| 973 |
|
$fooMetadata->setValueGenerator(new Mapping\ValueGeneratorMetadata(Mapping\GeneratorType::NONE)); |
| 974 |
|
$classMetadata->addProperty($fooMetadata); |
| 975 |
|
|
| 976 |
|
$barMetadata = new Mapping\FieldMetadata('b'); |
| 977 |
|
$barMetadata->setType(Type::getType(Type::INTEGER)); |
| 978 |
|
$barMetadata->setPrimaryKey(true); |
| 979 |
|
$barMetadata->setValueGenerator(new Mapping\ValueGeneratorMetadata(Mapping\GeneratorType::IDENTITY)); |
| 980 |
|
$classMetadata->addProperty($barMetadata); |
| 981 |
|
|
| 982 |
|
$classMetadata->validateValueGenerators(); |
| 983 |
|
} |
| 984 |
|
|
| 985 |
|
/** |
| 986 |
|
* @expectedException \Doctrine\ORM\Mapping\MappingException |
|
@@ 989-1007 (lines=19) @@
|
| 986 |
|
* @expectedException \Doctrine\ORM\Mapping\MappingException |
| 987 |
|
* @expectedExceptionMessage Entity 'Doctrine\Tests\Models\ValueGenerators\DummyWithThreeProperties' has a an Identity strategy defined on a non-primary field. This is not supported. |
| 988 |
|
*/ |
| 989 |
|
public function testNonPrimaryIdentityValueGenerator() : void |
| 990 |
|
{ |
| 991 |
|
$classMetadata = new ClassMetadata(DummyWithThreeProperties::class, $this->metadataBuildingContext); |
| 992 |
|
$classMetadata->setTable(new Mapping\TableMetadata()); |
| 993 |
|
|
| 994 |
|
$fooMetadata = new Mapping\FieldMetadata('a'); |
| 995 |
|
$fooMetadata->setType(Type::getType(Type::INTEGER)); |
| 996 |
|
$fooMetadata->setPrimaryKey(true); |
| 997 |
|
$fooMetadata->setValueGenerator(new Mapping\ValueGeneratorMetadata(Mapping\GeneratorType::NONE)); |
| 998 |
|
$classMetadata->addProperty($fooMetadata); |
| 999 |
|
|
| 1000 |
|
$barMetadata = new Mapping\FieldMetadata('b'); |
| 1001 |
|
$barMetadata->setType(Type::getType(Type::INTEGER)); |
| 1002 |
|
$barMetadata->setPrimaryKey(false); |
| 1003 |
|
$barMetadata->setValueGenerator(new Mapping\ValueGeneratorMetadata(Mapping\GeneratorType::IDENTITY)); |
| 1004 |
|
$classMetadata->addProperty($barMetadata); |
| 1005 |
|
|
| 1006 |
|
$classMetadata->validateValueGenerators(); |
| 1007 |
|
} |
| 1008 |
|
|
| 1009 |
|
/** |
| 1010 |
|
* @group DDC-1663 |