2011-11-28 23:31:06 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
2016-12-08 18:01:04 +01:00
|
|
|
use Doctrine\Tests\ORM\Mapping\Cat;
|
|
|
|
use Doctrine\Tests\ORM\Mapping\Dog;
|
2011-11-28 23:31:06 +03:00
|
|
|
|
|
|
|
/* @var $metadata ClassMetadataInfo */
|
|
|
|
$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE);
|
2016-12-07 23:33:41 +01:00
|
|
|
$metadata->setDiscriminatorColumn(
|
|
|
|
[
|
2011-11-28 23:31:06 +03:00
|
|
|
'name' => 'dtype',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => 255,
|
|
|
|
'fieldName' => 'dtype',
|
2016-12-07 23:33:41 +01:00
|
|
|
]
|
|
|
|
);
|
|
|
|
$metadata->setDiscriminatorMap(
|
|
|
|
[
|
2016-12-08 18:01:04 +01:00
|
|
|
'cat' => Cat::class,
|
|
|
|
'dog' => Dog::class,
|
2016-12-07 23:33:41 +01:00
|
|
|
]
|
|
|
|
);
|
2011-11-28 23:31:06 +03:00
|
|
|
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
|
2016-12-07 23:33:41 +01:00
|
|
|
$metadata->mapField(
|
|
|
|
[
|
2011-11-28 23:31:06 +03:00
|
|
|
'fieldName' => 'id',
|
|
|
|
'type' => 'string',
|
|
|
|
'length' => NULL,
|
|
|
|
'precision' => 0,
|
|
|
|
'scale' => 0,
|
|
|
|
'nullable' => false,
|
|
|
|
'unique' => false,
|
|
|
|
'id' => true,
|
|
|
|
'columnName' => 'id',
|
2016-12-07 23:33:41 +01:00
|
|
|
]
|
|
|
|
);
|
2011-11-28 23:31:06 +03:00
|
|
|
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM);
|
2016-12-07 23:33:41 +01:00
|
|
|
$metadata->setCustomGeneratorDefinition(["class" => "stdClass"]);
|