Commit 0d67fcaf authored by romanb's avatar romanb

merged fix for #912 from 0.10 to trunk (turned out it was not broken in trunk...

merged fix for #912 from 0.10 to trunk (turned out it was not broken in trunk but i merged the patch & testcase anyway. Other refactorings.
parent 33c76f62
......@@ -21,12 +21,12 @@
/**
* A <tt>ClassMetadata</tt> instance holds all the information (metadata) of an entity and
* it's associations and how they're mapped to the relational model.
* it's associations and how they're mapped to the relational database.
*
* @package Doctrine
* @subpackage ClassMetadata
* @author Roman Borschel <roman@code-factory.org>
* @since 1.0
* @since 2.0
*/
class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializable
{
......@@ -65,6 +65,11 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
protected $_parentClasses = array();
/**
* The names of all subclasses
*/
protected $_subClasses = array();
/**
* The field names of all fields that are part of the identifier/primary key
* of the described entity class.
......@@ -194,9 +199,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
protected $_enumMap = array();
/**
* @var array $options an array containing all options
*
* -- parents the parent classes of this component
* @var array $options an array containing all options
*
* -- treeImpl the tree implementation of this table (if any)
*
......@@ -204,12 +207,10 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*
* -- queryParts the bound query parts
*/
protected $_options = array(
'treeImpl' => null,
'treeOptions' => null,
'queryParts' => array(),
'subclasses' => array(),
'parents' => array()
protected $_options = array(
'treeImpl' => null,
'treeOptions' => null,
'queryParts' => array()
);
/**
......@@ -1098,7 +1099,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function setSubclasses(array $subclasses)
{
$this->_options['subclasses'] = $subclasses;
$this->_subClasses = $subclasses;
}
/**
......@@ -1108,7 +1109,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function getSubclasses()
{
return $this->getOption('subclasses');
return $this->_subClasses;
}
/**
......@@ -1118,7 +1119,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function hasSubclasses()
{
return ! $this->getOption('subclasses');
return ! $this->_subClasses;
}
/**
......@@ -1128,7 +1129,7 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function getParentClasses()
{
return $this->getOption('parents');
return $this->_parentClasses;
}
/**
......@@ -1136,18 +1137,18 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function setParentClasses(array $classNames)
{
$this->_options['parents'] = $classNames;
$this->_parentClasses = $classNames;
$this->_rootEntityName = array_pop($classNames);
}
/**
* Checks whether the class has any persistence parent classes.
* Checks whether the class has any persistent parent classes.
*
* @return boolean TRUE if the class has one or more persistent parent classes, FALSE otherwise.
*/
public function hasParentClasses()
{
return ! $this->getOption('parents');
return ! $this->_parentClasses;
}
/**
......@@ -1157,15 +1158,23 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function setInheritanceType($type, array $options = array())
{
if ($parentClassNames = $this->getParentClasses()) {
if ($this->_conn->getClassMetadata($parentClassNames[0])->getInheritanceType() != $type) {
throw new Doctrine_ClassMetadata_Exception("All classes in an inheritance hierarchy"
. " must share the same inheritance mapping type. Mixing is not allowed.");
}
}
if ($type == Doctrine::INHERITANCE_TYPE_SINGLE_TABLE) {
$this->_checkRequiredDiscriminatorOptions($options);
} else if ($type == Doctrine::INHERITANCE_TYPE_JOINED) {
$this->_checkRequiredDiscriminatorOptions($options);
} else if ($type == Doctrine::INHERITANCE_TYPE_TABLE_PER_CLASS) {
// concrete table inheritance ...
} else {
;
} else {
throw new Doctrine_ClassMetadata_Exception("Invalid inheritance type '$type'.");
}
$this->_inheritanceType = $type;
foreach ($options as $name => $value) {
$this->setInheritanceOption($name, $value);
......@@ -1269,13 +1278,13 @@ 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::INHERITANCE_TYPE_SINGLE_TABLE) {
$parents = $this->getOption('parents');
$parents = $this->getParentClasses();
if ($parents) {
$rootClass = $this->_conn->getClassMetadata(array_pop($parents));
} else {
$rootClass = $this;
}
$subClasses = $rootClass->getOption('subclasses');
$subClasses = $rootClass->getSubclasses();
foreach ($subClasses as $subClass) {
$subClassMetadata = $this->_conn->getClassMetadata($subClass);
$allColumns = array_merge($allColumns, $subClassMetadata->getColumns());
......@@ -1600,7 +1609,10 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
*/
public function serialize()
{
return serialize($this->_mappedColumns);
//$contents = get_object_vars($this);
/* @TODO How to handle $this->_conn and $this->_parser ? */
//return serialize($contents);
return "";
}
/**
......@@ -1750,6 +1762,17 @@ class Doctrine_ClassMetadata extends Doctrine_Configurable implements Serializab
//Doctrine::CLASSTYPE_TRANSIENT
}
/**
*
* @todo Implementation. Replaces the bindComponent() methods on the old Doctrine_Manager.
* Binding an Entity to a specific EntityManager in 2.0 is the same as binding
* it to a Connection in 1.0.
*/
public function bindToEntityManager($emName)
{
}
/**
* @todo Implementation. Immutable entities can not be updated or deleted once
* they are created. This means the entity can only be modified as long as it's
......
......@@ -133,13 +133,16 @@ class Doctrine_ClassMetadata_Factory
}
protected function _addInheritedRelations($subClass, $parentClass) {
foreach ($parentClass->getRelationParser()->getRelations() as $name => $relation) {
$subClass->getRelationParser()->addRelation($name, $relation);
foreach ($parentClass->getRelationParser()->getRelationDefinitions() as $name => $definition) {
$subClass->getRelationParser()->addRelationDefinition($name, $definition);
}
}
/**
* Current code driver.
* Loads the metadata of a specified class.
*
* @param Doctrine_ClassMetadata $class The container for the metadata.
* @param string $name The name of the class for which the metadata will be loaded.
*/
protected function _loadMetadata(Doctrine_ClassMetadata $class, $name)
{
......@@ -189,16 +192,6 @@ class Doctrine_ClassMetadata_Factory
return $class;
}
/**
* Code driver.
*
* @todo Move to code driver.
*/
/*protected function _loadMetadataFromCode($class, $name)
{
call_user_func_array(array($name, 'initMetadata'), array($class));
}*/
/**
* Initializes the class identifier(s)/primary key(s).
*
......@@ -209,9 +202,9 @@ class Doctrine_ClassMetadata_Factory
switch (count((array)$class->getIdentifier())) {
case 0:
if ($class->getInheritanceType() == Doctrine::INHERITANCE_TYPE_JOINED &&
count($class->getOption('parents')) > 0) {
count($class->getParentClasses()) > 0) {
$parents = $class->getOption('parents');
$parents = $class->getParentClasses();
$root = end($parents);
$rootClass = $class->getConnection()->getMetadata($root);
$class->setIdentifier($rootClass->getIdentifier());
......
......@@ -215,7 +215,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this->_mapper = $connection->getMapper($this->_mapper);
$keyColumn = isset($array['keyColumn']) ? $array['keyColumn'] : null;
$keyColumn = isset($array['keyField']) ? $array['keyField'] : null;
if ($keyColumn === null) {
$keyColumn = $this->_mapper->getClassMetadata()->getBoundQueryPart('indexBy');
}
......
......@@ -866,6 +866,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD
* @see Doctrine_Query
* @return Doctrine_Collection Collection of Doctrine_Record objects
* @todo package:orm
*/
public function query($query, array $params = array(), $hydrationMode = null)
{
......@@ -885,17 +886,17 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
try {
$event = new Doctrine_Event($this, Doctrine_Event::CONN_PREPARE, $statement);
$this->getAttribute(Doctrine::ATTR_LISTENER)->prePrepare($event);
$stmt = false;
if ( ! $event->skipOperation) {
$stmt = $this->dbh->prepare($statement);
}
$this->getAttribute(Doctrine::ATTR_LISTENER)->postPrepare($event);
return new Doctrine_Connection_Statement($this, $stmt);
} catch(Doctrine_Adapter_Exception $e) {
} catch(PDOException $e) { }
......
......@@ -1159,7 +1159,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
// as soon as ONE table is exported, because the data of one class is stored
// across many tables.
if ($classMetadata->getInheritanceType() == Doctrine::INHERITANCE_TYPE_JOINED) {
$parents = $classMetadata->getOption('parents');
$parents = $classMetadata->getParentClasses();
foreach ($parents as $parent) {
$data = $classMetadata->getConnection()->getClassMetadata($parent)->getExportableFormat();
$query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']);
......
......@@ -162,10 +162,8 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
// $prev[$rootAlias] now points to the last element in $result.
// now hydrate the rest of the data found in the current row, that belongs to other
// (related) components.
foreach ($rowData as $dqlAlias => $data) {
$index = false;
$oneToOne = false;
$map = $this->_queryComponents[$dqlAlias];
$table = $map['table'];
$mapper = $map['mapper'];
......@@ -187,6 +185,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
// check the type of the relation
if ( ! $relation->isOneToOne() && $driver->initRelated($prev[$parent], $relationAlias)) {
$oneToOne = false;
// append element
if (isset($nonemptyComponents[$dqlAlias])) {
if ($isSimpleQuery || ! isset($identifierMap[$path][$id[$parent]][$id[$dqlAlias]])) {
......
......@@ -21,7 +21,7 @@
/**
* The joined mapping strategy maps a single entity instance to several tables in the
* database as it is defined by <b>Class Table Inheritance</b>.
* database as it is defined by <tt>Class Table Inheritance</tt>.
*
* @author Roman Borschel <roman@code-factory.org>
* @package Doctrine
......@@ -175,7 +175,7 @@ class Doctrine_Mapper_JoinedStrategy extends Doctrine_Mapper_Strategy
foreach ($classMetadata->getParentClasses() as $parentClass) {
$customJoins[$parentClass] = 'INNER';
}
foreach ((array)$classMetadata->getSubclasses() as $subClass) {
foreach ($classMetadata->getSubclasses() as $subClass) {
if ($subClass != $this->_mapper->getComponentName()) {
$customJoins[$subClass] = 'LEFT';
}
......@@ -200,7 +200,7 @@ class Doctrine_Mapper_JoinedStrategy extends Doctrine_Mapper_Strategy
$fields = array($classMetadata->getInheritanceOption('discriminatorColumn'));
if ($classMetadata->getSubclasses()) {
foreach ($classMetadata->getSubclasses() as $subClass) {
$fields = array_merge($conn->getMetadata($subClass)->getFieldNames(), $fields);
$fields = array_merge($conn->getClassMetadata($subClass)->getFieldNames(), $fields);
}
}
......
......@@ -75,7 +75,7 @@ class Doctrine_Node implements IteratorAggregate
$class = $record->getTable()->getComponentName();
$table = $record->getTable();
if ($table->getOption('inheritanceMap')) {
$subclasses = $table->getOption('subclasses');
$subclasses = $table->getSubclasses();
while (in_array($class, $subclasses)) {
$class = get_parent_class($class);
}
......
......@@ -30,7 +30,7 @@
* @link www.phpdoctrine.org
* @since 1.0
*/
abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract
abstract class Doctrine_Record_Generator
{
/**
* @var array $_options an array of plugin specific options
......
......@@ -46,14 +46,14 @@ class Doctrine_Relation_Parser
/**
* @var array $_pending relations waiting for parsing
*/
protected $_pending = array();
protected $_relationDefinitions = array();
/**
* constructor
*
* @param Doctrine_Table $table the table object this parser belongs to
*/
public function __construct(/*Doctrine_Table*/ $table)
public function __construct(Doctrine_ClassMetadata $table)
{
$this->_table = $table;
}
......@@ -72,19 +72,30 @@ class Doctrine_Relation_Parser
* getPendingRelation
*
* @return array an array defining a pending relation
* @deprecated
*/
public function getPendingRelation($name)
{
if ( ! isset($this->_pending[$name])) {
throw new Doctrine_Relation_Exception('Unknown pending relation ' . $name);
return $this->getRelationDefinition($name);
}
public function getRelationDefinition($name)
{
if ( ! isset($this->_relationDefinitions[$name])) {
throw new Doctrine_Relation_Exception("Unknown relation '$name'.");
}
return $this->_pending[$name];
return $this->_relationDefinitions[$name];
}
public function getRelationDefinitions()
{
return $this->_relationDefinitions;
}
public function hasRelation($name)
{
if ( ! isset($this->_pending[$name]) && ! isset($this->_relations[$name])) {
if ( ! isset($this->_relationDefinitions[$name]) && ! isset($this->_relations[$name])) {
return false;
}
......@@ -112,9 +123,9 @@ class Doctrine_Relation_Parser
throw new Doctrine_Relation_Exception('Relation type not set.');
}
$this->_pending[$alias] = array_merge($options, array('class' => $name, 'alias' => $alias));
$this->_relationDefinitions[$alias] = array_merge($options, array('class' => $name, 'alias' => $alias));
return $this->_pending[$alias];
return $this->_relationDefinitions[$alias];
}
/**
......@@ -128,7 +139,7 @@ class Doctrine_Relation_Parser
return $this->_relations[$alias];
}
if (isset($this->_pending[$alias])) {
if (isset($this->_relationDefinitions[$alias])) {
$this->_loadRelation($alias);
}
......@@ -154,6 +165,14 @@ class Doctrine_Relation_Parser
$this->_relations[$name] = $relation;
}
public function addRelationDefinition($name, array $definition)
{
if (isset($this->_relationDefinitions[$name])) {
throw new Doctrine_Relation_Exception("Relation definition for '$name' does already exist.");
}
$this->_relationDefinitions[$name] = $definition;
}
/**
* Loads a relation and puts it into the collection of loaded relations.
* In the process of initializing a relation it is common that multiple other, closely related
......@@ -163,17 +182,17 @@ class Doctrine_Relation_Parser
*/
protected function _loadRelation($alias)
{
$def = $this->_pending[$alias];
$def = $this->_relationDefinitions[$alias];
// check if reference class name exists
// if it does we are dealing with an association relation (many-many)
if (isset($def['refClass'])) {
$def = $this->completeAssocDefinition($def);
$localClasses = array_merge($this->_table->getOption('parents'), array($this->_table->getClassName()));
$localClasses = array_merge($this->_table->getParentClasses(), array($this->_table->getClassName()));
$relationName = $def['refClass'];
if ( ! isset($this->_pending[$relationName]) && ! isset($this->_relations[$relationName])) {
if ( ! isset($this->_relationDefinitions[$relationName]) && ! isset($this->_relations[$relationName])) {
$this->_completeManyToManyRelation($def);
}
......@@ -193,7 +212,6 @@ class Doctrine_Relation_Parser
}
}
if (isset($rel)) {
unset($this->_pending[$alias]);
$this->_relations[$alias] = $rel;
return $rel;
}
......@@ -242,7 +260,7 @@ class Doctrine_Relation_Parser
*/
public function getRelations()
{
foreach ($this->_pending as $k => $v) {
foreach ($this->_relationDefinitions as $k => $v) {
$this->getRelation($k);
}
......@@ -401,8 +419,8 @@ class Doctrine_Relation_Parser
$def['table'] = $this->getImpl($def, 'class');
$def['localTable'] = $this->_table;
$foreignClasses = array_merge($def['table']->getOption('parents'), array($def['class']));
$localClasses = array_merge($this->_table->getOption('parents'), array($this->_table->getClassName()));
$foreignClasses = array_merge($def['table']->getParentClasses(), array($def['class']));
$localClasses = array_merge($this->_table->getParentClasses(), array($this->_table->getClassName()));
$localIdentifierColumnNames = $this->_table->getIdentifierColumnNames();
$localIdColumnName = $localIdentifierColumnNames[count($localIdentifierColumnNames) - 1];
......
......@@ -56,7 +56,7 @@ class Doctrine_Tree
$this->_baseComponent = $table->getComponentName();
$class = $this->_baseComponent;
if ($table->getOption('inheritanceMap')) {
$subclasses = $table->getOption('subclasses');
$subclasses = $table->getSubclasses();
while (in_array($class, $subclasses)) {
$class = get_parent_class($class);
}
......
......@@ -45,10 +45,10 @@ class Doctrine_Inheritance_Joined_TestCase extends Doctrine_UnitTestCase
$this->assertEqual('cti_supermanager', $suManagerTable->getTableName());
// expected joined parents option
$this->assertEqual(array(), $userTable->getOption('parents'));
$this->assertEqual(array('CTI_User'), $managerTable->getOption('parents'));
$this->assertEqual(array('CTI_User'), $customerTable->getOption('parents'));
$this->assertEqual(array('CTI_Manager', 'CTI_User'), $suManagerTable->getOption('parents'));
$this->assertEqual(array(), $userTable->getParentClasses());
$this->assertEqual(array('CTI_User'), $managerTable->getParentClasses());
$this->assertEqual(array('CTI_User'), $customerTable->getParentClasses());
$this->assertEqual(array('CTI_Manager', 'CTI_User'), $suManagerTable->getParentClasses());
// check inheritance map
$this->assertEqual(array(1 => 'CTI_User', 2 => 'CTI_Manager',
......
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Ticket_912_TestCase
*
* @package Doctrine
* @author David Stendardi <david.stendardi@adenclassifieds.com>
* @category Object Relational Mapping
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
*/
class Doctrine_Ticket_912_TestCase extends Doctrine_UnitTestCase {
/**
* prepareData
*/
public function prepareData()
{
$oResume = new ticket912_Resume;
$oResume->title = 'titre';
$oResume->Person->name = 'David';
$oResume->KnownLanguages[0]->comments = 'foo';
$oResume->KnownLanguages[0]->Language->label = "Enlish";
$oResume->KnownLanguages[0]->Level->label = "Fluent";
$oResume->save();
}
/**
* prepareTables
*/
public function prepareTables()
{
$this->tables = array();
$this->tables[] = 'ticket912_Resume';
$this->tables[] = 'ticket912_Person';
$this->tables[] = 'ticket912_ResumeHasLanguage';
$this->tables[] = 'ticket912_LanguageLevel';
$this->tables[] = 'ticket912_Language';
parent :: prepareTables();
}
/**
* Test the existence expected indexes
*/
public function testTicket()
{
$q = new Doctrine_Query();
// simple query with deep relations
$q->addSelect('Resume.id, Person.id, Person.name, KnownLanguages.id, Level.label, Language.label')
->from('ticket912_Resume Resume')
->leftJoin('Resume.Person Person')
->leftJoin('Resume.KnownLanguages KnownLanguages')
->leftJoin('KnownLanguages.Level Level')
->leftJoin('KnownLanguages.Language Language');
$aResult = $q->fetchArray();
// should be setted..
$issetLevel = isset($aResult[0]['KnownLanguages'][0]['Level']);
$issetLanguage = isset($aResult[0]['KnownLanguages'][0]['Language']);
$this->assertTrue($issetLevel);
$this->assertTrue($issetLanguage);
}
}
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class ticket912_Resume extends Doctrine_Record
{
public static function initMetadata($mapping)
{
$mapping->setTableName('resume');
$mapping->mapColumn('id', 'integer', 8, array (
'primary' => true,
'autoincrement' => true,
'unsigned' => true,
));
$mapping->mapColumn('person_id', 'integer', 8, array('unsigned' => true));
$mapping->mapColumn('title', 'string', 255);
$mapping->hasMany('ticket912_ResumeHasLanguage as KnownLanguages', array('local' => 'id', 'foreign' => 'resume_id'));
$mapping->hasOne('ticket912_Person as Person', array(
'local' => 'person_id',
'foreign' => 'id',
'onDelete' => 'SET NULL',
'onUpdate' => 'CASCADE'
));
}
}
/**
* First level one to one relation class Language
*/
class ticket912_Person extends Doctrine_Record
{
public static function initMetadata($mapping)
{
$mapping->setTableName('person');
$mapping->mapColumn('id', 'integer', 8, array (
'primary' => true,
'autoincrement' => true,
'unsigned' => true,
));
$mapping->mapColumn('name', 'string', 255, array ());
}
}
/**
* Second level one to many relation class ResumeHasLanguageLanguage
*/
class ticket912_ResumeHasLanguage extends Doctrine_Record
{
public static function initMetadata($mapping)
{
$mapping->setTableName('resume_has_language');
$mapping->mapColumn('id', 'integer', 8, array (
'primary' => true,
'autoincrement' => true,
'unsigned' => true,
));
$mapping->mapColumn('resume_id', 'integer', 8, array (
'notnull' => true,
'unsigned' => true,
));
$mapping->mapColumn('language_id', 'integer', 2, array (
'unsigned' => true,
));
$mapping->mapColumn('language_level_id', 'integer', 2, array (
'unsigned' => true,
));
$mapping->mapColumn('comments', 'string', 4000, array ());
$mapping->hasOne('ticket912_Resume as Resume', array('local' => 'resume_id',
'foreign' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'CASCADE'));
$mapping->hasOne('ticket912_Language as Language', array('local' => 'language_id',
'foreign' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'CASCADE'));
$mapping->hasOne('ticket912_LanguageLevel as Level', array('local' => 'language_level_id',
'foreign' => 'id',
'onDelete' => 'SET NULL',
'onUpdate' => 'CASCADE'));
}
}
/**
* Third level one to one relation class Language
*/
class ticket912_Language extends Doctrine_Record
{
public static function initMetadata($mapping)
{
$mapping->setTableName('language');
$mapping->mapColumn('id', 'integer', 2, array(
'primary' => true,
'autoincrement' => true,
'unsigned' => true,
));
$mapping->mapColumn('label', 'string', 100, array ('notnull' => true));
$mapping->hasMany('ticket912_Resume as Resumes', array('local' => 'id', 'foreign' => 'language_id'));
$mapping->hasMany('ticket912_ResumeHasLanguage as ResumeKnownLanguages', array('local' => 'id', 'foreign' => 'language_id'));
}
}
/**
* Third level one to one relation class Language
*/
class ticket912_LanguageLevel extends Doctrine_Record
{
public static function initMetadata($mapping)
{
$mapping->setTableName('language_level');
$mapping->mapColumn('id', 'integer', 2, array (
'primary' => true,
'autoincrement' => true,
'unsigned' => true,
));
$mapping->mapColumn('label', 'string', 100, array ('notnull' => true));
$mapping->hasMany('ticket912_ResumeHasLanguage as ResumeKnownLanguages', array(
'local' => 'id',
'foreign' => 'language_level_id'));
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ class User extends Entity
'local' => 'user_id',
'foreign' => 'group_id',
'refClass' => 'Groupuser'
));
));
}
/** Custom validation */
......
......@@ -26,6 +26,7 @@ $tickets->addTestCase(new Doctrine_Ticket_638_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_673_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_626D_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_697_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_912_TestCase());
$test->addTestCase($tickets);
// Connection drivers (not yet fully tested)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment