1
0
mirror of synced 2024-12-12 22:36:02 +03:00

refactorings

This commit is contained in:
romanb 2008-03-23 11:30:29 +00:00
parent 7a1beb5b26
commit 33c76f620e
29 changed files with 108 additions and 97 deletions

View File

@ -567,27 +567,28 @@ final class Doctrine
/**
* INHERITANCE TYPE CONSTANTS.
*/
const INHERITANCE_TYPE_NONE = 0;
/**
* Constant for Single Table Inheritance.
*
* @see http://martinfowler.com/eaaCatalog/singleTableInheritance.html
*/
const INHERITANCETYPE_SINGLE_TABLE = 1;
const INHERITANCE_TYPE_SINGLE_TABLE = 1;
/**
* Constant for Class Table Inheritance.
*
* @see http://martinfowler.com/eaaCatalog/classTableInheritance.html
*/
const INHERITANCETYPE_JOINED = 2;
const INHERITANCE_TYPE_JOINED = 2;
/**
* Constant for Concrete Table Inheritance.
*
* @see http://martinfowler.com/eaaCatalog/concreteTableInheritance.html
*/
const INHERITANCETYPE_TABLE_PER_CLASS = 3;
const INHERITANCE_TYPE_TABLE_PER_CLASS = 3;
/**

View File

@ -87,7 +87,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*
* @var integer
*/
protected $_inheritanceType = Doctrine::INHERITANCETYPE_TABLE_PER_CLASS;
protected $_inheritanceType = Doctrine::INHERITANCE_TYPE_NONE;
/**
* An array containing all behaviors attached to the class.
@ -1157,11 +1157,11 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function setInheritanceType($type, array $options = array())
{
if ($type == Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
if ($type == Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$this->_checkRequiredDiscriminatorOptions($options);
} else if ($type == Doctrine::INHERITANCETYPE_JOINED) {
} else if ($type == Doctrine::INHERITANCE_TYPE_JOINED) {
$this->_checkRequiredDiscriminatorOptions($options);
} else if ($type == Doctrine::INHERITANCETYPE_TABLE_PER_CLASS) {
} else if ($type == Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS) {
// concrete table inheritance ...
} else {
throw new Doctrine_ClassMetadata_Exception("Invalid inheritance type '$type'.");
@ -1268,7 +1268,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
// If the class is part of a Single Table Inheritance hierarchy, collect the fields
// of all classes in the hierarchy.
if ($this->_inheritanceType == Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
if ($this->_inheritanceType == Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$parents = $this->getOption('parents');
if ($parents) {
$rootClass = $this->_conn->getClassMetadata(array_pop($parents));
@ -1280,7 +1280,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
$subClassMetadata = $this->_conn->getClassMetadata($subClass);
$allColumns = array_merge($allColumns, $subClassMetadata->getColumns());
}
} else if ($this->_inheritanceType == Doctrine::INHERITANCETYPE_JOINED) {
} else if ($this->_inheritanceType == Doctrine::INHERITANCE_TYPE_JOINED) {
// Remove inherited, non-pk fields. They're not in the table of this class
foreach ($allColumns as $name => $definition) {
if (isset($definition['primary']) && $definition['primary'] === true) {
@ -1293,7 +1293,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
unset($allColumns[$name]);
}
}
} else if ($this->_inheritanceType == Doctrine::INHERITANCETYPE_TABLE_PER_CLASS) {
} else if ($this->_inheritanceType == Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS) {
// If this is a subclass, just remove existing autoincrement options on the pk
if ($this->getParentClasses()) {
foreach ($allColumns as $name => $definition) {

View File

@ -114,7 +114,7 @@ class Doctrine_ClassMetadata_Factory
$this->_addInheritedFields($subClass, $parent);
$this->_addInheritedRelations($subClass, $parent);
$this->_loadMetadata($subClass, $subclassName);
if ($parent->getInheritanceType() == Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
if ($parent->getInheritanceType() == Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$subClass->setTableName($parent->getTableName());
}
$classes[$subclassName] = $subClass;
@ -208,7 +208,7 @@ class Doctrine_ClassMetadata_Factory
{
switch (count((array)$class->getIdentifier())) {
case 0:
if ($class->getInheritanceType() == Doctrine::INHERITANCETYPE_JOINED &&
if ($class->getInheritanceType() == Doctrine::INHERITANCE_TYPE_JOINED &&
count($class->getOption('parents')) > 0) {
$parents = $class->getOption('parents');

View File

@ -81,7 +81,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*
* @var string
*/
protected $keyColumn;
protected $_keyField;
/**
* Helper variable. Used for fast null value testing.
@ -101,23 +101,26 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
* @param string $keyColumn The field name that will be used as the key
* in the collection.
*/
public function __construct($mapper, $keyColumn = null)
public function __construct($mapper, $keyField = null)
{
if (is_string($mapper)) {
$mapper = Doctrine_Manager::getInstance()->getMapper($mapper);
}
$this->_mapper = $mapper;
if ($keyColumn === null) {
$keyColumn = $mapper->getClassMetadata()->getBoundQueryPart('indexBy');
if ($keyField === null) {
$keyField = $mapper->getClassMetadata()->getBoundQueryPart('indexBy');
}
if ($keyColumn === null) {
$keyColumn = $mapper->getClassMetadata()->getAttribute(Doctrine::ATTR_COLL_KEY);
if ($keyField === null) {
$keyField = $mapper->getClassMetadata()->getAttribute(Doctrine::ATTR_COLL_KEY);
}
if ($keyColumn !== null) {
$this->keyColumn = $keyColumn;
if ($keyField !== null) {
if ( ! $this->_mapper->getClassMetadata()->hasField($keyField)) {
throw new Doctrine_Collection_Exception("Invalid field '$keyField' can't be uses as key.");
}
$this->_keyField = $keyField;
}
}
@ -218,32 +221,32 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
}
if ($keyColumn !== null) {
$this->keyColumn = $keyColumn;
$this->_keyField = $keyColumn;
}
}
/**
* setKeyColumn
* setKeyField
* sets the key column for this collection
*
* @param string $column
* @return Doctrine_Collection
*/
public function setKeyColumn($column)
public function setKeyField($fieldName)
{
$this->keyColumn = $column;
$this->_keyField = $fieldName;
return $this;
}
/**
* getKeyColumn
* getKeyField
* returns the name of the key column
*
* @return string
*/
public function getKeyColumn()
public function getKeyField()
{
return $this->keyColumn;
return $this->_keyField;
}
/**
@ -408,8 +411,8 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this->data[$key] = $record;
}
if (isset($this->keyColumn)) {
$record->set($this->keyColumn, $key);
if (isset($this->_keyField)) {
$record->set($this->_keyField, $key);
}
return $record;
@ -535,10 +538,10 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
}
// why is this not checked when the keyColumn is set?
if (isset($this->keyColumn)) {
$value = $record->get($this->keyColumn);
if (isset($this->_keyField)) {
$value = $record->get($this->_keyField);
if ($value === null) {
throw new Doctrine_Collection_Exception("Couldn't create collection index. Record field '".$this->keyColumn."' was null.");
throw new Doctrine_Collection_Exception("Couldn't create collection index. Record field '".$this->_keyField."' was null.");
}
$this->data[$value] = $record;
} else {

View File

@ -1144,11 +1144,11 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
} else {
// instantiate correct mapper type
$inheritanceType = $metadata->getInheritanceType();
if ($inheritanceType == Doctrine::INHERITANCETYPE_JOINED) {
if ($inheritanceType == Doctrine::INHERITANCE_TYPE_JOINED) {
$mapper = new Doctrine_Mapper_Joined($entityName, $metadata);
} else if ($inheritanceType == Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
} else if ($inheritanceType == Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$mapper = new Doctrine_Mapper_SingleTable($entityName, $metadata);
} else if ($inheritanceType == Doctrine::INHERITANCETYPE_TABLE_PER_CLASS) {
} else if ($inheritanceType == Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS) {
$mapper = new Doctrine_Mapper_TablePerClass($entityName, $metadata);
} else {
throw new Doctrine_Connection_Exception("Unknown inheritance type '$inheritanceType'. Can't create mapper.");

View File

@ -1158,7 +1158,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
// In Class Table Inheritance we have to make sure that ALL tables are exported
// as soon as ONE table is exported, because the data of one class is stored
// across many tables.
if ($classMetadata->getInheritanceType() == Doctrine::INHERITANCETYPE_JOINED) {
if ($classMetadata->getInheritanceType() == Doctrine::INHERITANCE_TYPE_JOINED) {
$parents = $classMetadata->getOption('parents');
foreach ($parents as $parent) {
$data = $classMetadata->getConnection()->getClassMetadata($parent)->getExportableFormat();

View File

@ -87,7 +87,7 @@ class Doctrine_Mapper
$this->_conn = $classMetadata->getConnection();
$this->_classMetadata = $classMetadata;
$this->_nullObject = Doctrine_Null::$INSTANCE;
if ($classMetadata->getInheritanceType() == Doctrine::INHERITANCETYPE_JOINED) {
if ($classMetadata->getInheritanceType() == Doctrine::INHERITANCE_TYPE_JOINED) {
$this->_mappingStrategy = new Doctrine_Mapper_JoinedStrategy($this);
} else {
$this->_mappingStrategy = new Doctrine_Mapper_DefaultStrategy($this);

View File

@ -58,27 +58,6 @@ class Doctrine_Mapper_DefaultStrategy extends Doctrine_Mapper_Strategy
}
}
/**
* deletes all related composites
* this method is always called internally when a record is deleted
*
* @throws PDOException if something went wrong at database level
* @return void
*/
protected function _deleteComposites(Doctrine_Record $record)
{
$classMetadata = $this->_mapper->getClassMetadata();
foreach ($classMetadata->getRelations() as $fk) {
if ($fk->isComposite()) {
$obj = $record->get($fk->getAlias());
if ($obj instanceof Doctrine_Record &&
$obj->state() != Doctrine_Record::STATE_LOCKED) {
$obj->delete($this->_mapper->getConnection());
}
}
}
}
/**
* Inserts a single entity into the database, without any related entities.
*

View File

@ -135,18 +135,19 @@ class Doctrine_Mapper_JoinedStrategy extends Doctrine_Mapper_Strategy
try {
$class = $this->_mapper->getClassMetadata();
$conn->beginInternalTransaction();
$this->deleteComposites($record);
$this->_deleteComposites($record);
$record->state(Doctrine_Record::STATE_TDIRTY);
$identifier = $this->_convertFieldToColumnNames($record->identifier(), $class);
// run deletions, starting from the class, upwards the hierarchy
$conn->delete($class->getTableName(), $identifier);
foreach ($class->getParentClasses() as $parent) {
$parentClass = $conn->getClassMetadata($parent);
$this->_deleteRow($parentClass->getTableName(), $identifier);
}
$conn->delete($class->getTableName(), $identifier);
$record->state(Doctrine_Record::STATE_TCLEAN);
$this->_mapper->removeRecord($record);

View File

@ -60,6 +60,27 @@ abstract class Doctrine_Mapper_Strategy
return $converted;
}
/**
* deletes all related composites
* this method is always called internally when a record is deleted
*
* @throws PDOException if something went wrong at database level
* @return void
*/
protected function _deleteComposites(Doctrine_Record $record)
{
$classMetadata = $this->_mapper->getClassMetadata();
foreach ($classMetadata->getRelations() as $fk) {
if ($fk->isComposite()) {
$obj = $record->get($fk->getAlias());
if ($obj instanceof Doctrine_Record &&
$obj->state() != Doctrine_Record::STATE_LOCKED) {
$obj->delete($this->_mapper->getConnection());
}
}
}
}
/**
* Callback that is invoked during the SQL construction process.
*/

View File

@ -562,7 +562,7 @@ abstract class Doctrine_Query_Abstract
$array = array();
foreach ($this->_queryComponents as $componentAlias => $data) {
$sqlTableAlias = $this->getSqlTableAlias($componentAlias);
if ($data['table']->getInheritanceType() != Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
if ($data['table']->getInheritanceType() != Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$array[$sqlTableAlias][] = array();
} else {
$discCol = $data['table']->getInheritanceOption('discriminatorColumn');

View File

@ -1237,8 +1237,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
// @todo cleanup
// populates the discriminator field in Single & Class Table Inheritance
if ($this->_class->getInheritanceType() == Doctrine::INHERITANCETYPE_JOINED ||
$this->_class->getInheritanceType() == Doctrine::INHERITANCETYPE_SINGLE_TABLE) {
if ($this->_class->getInheritanceType() == Doctrine::INHERITANCE_TYPE_JOINED ||
$this->_class->getInheritanceType() == Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$discCol = $this->_class->getInheritanceOption('discriminatorColumn');
$discMap = $this->_class->getInheritanceOption('discriminatorMap');
$old = $this->get($discCol, false);

View File

@ -21,7 +21,7 @@ class Orm_Component_AllTests
{
$suite = new Doctrine_TestSuite('Doctrine Orm Component');
//$suite->addTestSuite('Orm_Component_TestTest');
$suite->addTestSuite('Orm_Component_TestTest');
$suite->addTestSuite('Orm_Component_AccessTest');
$suite->addTestSuite('Orm_Component_CollectionTest');

View File

@ -57,7 +57,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
public function shouldHaveBlankAsDefaultKeyColumn()
{
$this->assertEquals('', $this->coll->getKeyColumn());
$this->assertEquals('', $this->coll->getKeyField());
}
@ -67,7 +67,7 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
public function shouldUseSpecifiedKeyColumn()
{
$coll = new Doctrine_Collection('ForumUser', 'id');
$this->assertEquals('id', $coll->getKeyColumn());
$this->assertEquals('id', $coll->getKeyField());
}
/**
@ -75,11 +75,11 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
* possible to set this to something that is not valid.
*
* @test
* @expectedException Doctrine_Exception
* @expectedException Doctrine_Collection_Exception
*/
public function shouldThrowExceptionIfNonValidFieldSetAsKey()
{
$coll = new Doctrine_Collection('ForumUser', 'rat');
$coll = new Doctrine_Collection('ForumUser', 'xxNonValidFieldxx');
}
/**
@ -87,8 +87,8 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
public function shouldSerializeEmptyCollection()
{
$serializedFormCollection='C:19:"Doctrine_Collection":158:{a:7:{s:4:"data";a:0:{}s:7:"_mapper";s:9:"ForumUser";s:9:"_snapshot";a:0:{}s:14:"referenceField";N;s:9:"keyColumn";N;s:8:"_locator";N;s:10:"_resources";a:0:{}}}';
$this->assertEquals($serializedFormCollection, serialize($this->coll));
$serialized = serialize($this->coll);
$this->assertTrue(is_string($serialized));
}
/**
@ -96,8 +96,8 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
*/
public function shouldUnserializeEmptyCollectionIntoObject()
{
$serializedFormCollection='C:19:"Doctrine_Collection":158:{a:7:{s:4:"data";a:0:{}s:7:"_mapper";s:9:"ForumUser";s:9:"_snapshot";a:0:{}s:14:"referenceField";N;s:9:"keyColumn";N;s:8:"_locator";N;s:10:"_resources";a:0:{}}}';
$coll = unserialize($serializedFormCollection);
$serialized = serialize($this->coll);
$coll = unserialize($serialized);
$this->assertEquals('Doctrine_Collection', get_class($coll));
}
@ -119,12 +119,11 @@ class Orm_Component_CollectionTest extends Doctrine_OrmTestCase
$serialized = serialize($this->cmsColl);
$coll = unserialize($serialized);
$this->assertEquals('username', $coll->getKeyColumn());
$this->assertEquals('username', $coll->getKeyField());
$this->assertTrue(isset($coll['test']));
$user = $coll['test'];
$this->assertTrue($user instanceOf CmsUser);
$this->assertEquals('test', $user['username']);
}
}

View File

@ -28,4 +28,11 @@ class Orm_Component_TestTest extends Doctrine_OrmTestCase
$forumUsers = $this->sharedFixture['connection']->query("FROM ForumUser u");
$this->assertEquals(2, count($forumUsers));
}
public function testFixture3()
{
$forumAdmins = $this->sharedFixture['connection']->query("FROM ForumAdministrator adm");
$this->assertEquals(1, count($forumAdmins));
$forumAdmins[0]->delete();
}
}

View File

@ -4,11 +4,7 @@ $fixture = array(
'rows' => array(
array(
'id' => 1,
'foo' => 'bar'
),
array(
'id' => 2,
'foo' => 'bar2'
'access_level' => 4
)
)
);

View File

@ -4,6 +4,8 @@ class ForumAdministrator extends ForumUser
{
public static function initMetadata($class)
{
$class->mapColumn('foo', 'string', 50);
$class->mapColumn('access_level as accessLevel', 'integer', 1);
}
public function banUser(ForumUser $user) {}
}

View File

@ -5,18 +5,18 @@ class ForumUser extends Doctrine_Record
public static function initMetadata($class)
{
// inheritance mapping
$class->setInheritanceType(Doctrine::INHERITANCETYPE_JOINED, array(
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array(
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(
'user' => 'ForumUser',
'admin' => 'ForumAdministrator')
));
// register subclasses
$class->setSubclasses(array('ForumAdministrator'));
// the discriminator column
$class->mapColumn('dtype', 'string', 50);
// column mapping
// column-to-field mapping
$class->mapColumn('id', 'integer', 4, array(
'primary' => true,
'autoincrement' => true));

View File

@ -229,7 +229,7 @@ class CTITestParent1 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setInheritanceType(Doctrine::INHERITANCETYPE_JOINED, array(
$this->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array(
'CTITestParent1' => 1, 'CTITestParent2' => 2,
'CTITestParent3' => 3, 'CTITestParent4' => 4,
'CTITest' => 5));

View File

@ -255,14 +255,14 @@ class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase
$coll->setKeyColumn('id');
$coll->setKeyField('id');
$user = $this->connection->getTable("User")->find(4);
}
public function testGenerator()
{
$coll = new Doctrine_Collection($this->objTable);
$coll->setKeyColumn('name');
$coll->setKeyField('name');
$user = new User();
$user->name = "name";

View File

@ -187,7 +187,7 @@ class CTI_User extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCETYPE_JOINED, array(
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array(
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(1 => 'CTI_User', 2 => 'CTI_Manager',
3 => 'CTI_Customer', 4 => 'CTI_SuperManager')

View File

@ -67,7 +67,7 @@ class STI_User extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCETYPE_SINGLE_TABLE, array(
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, array(
'discriminatorColumn' => 'type',
'discriminatorMap' => array(
1 => 'STI_User',

View File

@ -70,7 +70,7 @@ class CCTI_User extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCETYPE_TABLE_PER_CLASS);
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS);
$class->setTableName('ccti_user');
$class->setSubclasses(array('CCTI_Manager', 'CCTI_Customer', 'CCTI_SuperManager'));
$class->setColumn('ccti_id as id', 'integer', 4, array ('primary' => true, 'autoincrement' => true));

View File

@ -146,7 +146,7 @@ class Metadata_User extends Doctrine_Record
public static function initMetadata(Doctrine_ClassMetadata $class)
{
$class->setTableName('cti_user');
$class->setInheritanceType(Doctrine::INHERITANCETYPE_JOINED,
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED,
array('discriminatorColumn' => 'type',
'discriminatorMap' => array(
1 => 'CTI_User',
@ -200,7 +200,7 @@ class Metadata_STI_User extends Doctrine_Record
public static function initMetadata($class)
{
$class->setTableName('cti_user');
$class->setInheritanceType(Doctrine::INHERITANCETYPE_SINGLE_TABLE,
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE,
array('discriminatorColumn' => 'type',
'discriminatorMap' => array(
1 => 'CTI_User',

View File

@ -40,7 +40,7 @@ class T697_Person extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCETYPE_JOINED, array(
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_JOINED, array(
'discriminatorColumn' => 'dtype',
'discriminatorMap' => array(
1 => 'T697_Person', 2 => 'T697_User'

View File

@ -3,6 +3,7 @@ abstract class BaseSymfonyRecord extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS);
$class->setColumn('name', 'string', 30);
}

View File

@ -13,7 +13,7 @@ class Entity extends Doctrine_Record
$class->setColumn('email_id', 'integer');
$class->setSubclasses(array('Group', 'User'));
$class->setInheritanceType(Doctrine::INHERITANCETYPE_SINGLE_TABLE, array(
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, array(
'discriminatorColumn' => 'type',
'discriminatorMap' => array(0 => 'User', 1 => 'Group', 2 => 'Entity')
));

View File

@ -3,7 +3,7 @@ class InheritanceEntityUser extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCETYPE_SINGLE_TABLE, array(
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_SINGLE_TABLE, array(
'discriminatorColumn' => 'type',
'discriminatorMap' => array(1 => 'InheritanceDealUser', 2 => 'InheritanceEntityUser')
));

View File

@ -3,6 +3,7 @@ class RelationTest extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setInheritanceType(Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS);
$class->setColumn('name', 'string', 200);
$class->setColumn('parent_id', 'integer');
}