Author: guilhermeblanco
Date: 2008-08-27 03:30:02 +0100 (Wed, 27 Aug 2008)
New Revision: 4829
Modified:
branches/1.0/lib/Doctrine/Record/Abstract.php
branches/1.0/lib/Doctrine/Table.php
branches/1.0/tests/TableTestCase.php
branches/1.0/tests/models/Entity.php
branches/1.0/tests/models/FilterTest.php
branches/1.0/tests/models/Package.php
branches/1.0/tests/models/QueryTest_Board.php
branches/1.0/tests/models/QueryTest_Category.php
branches/1.0/tests/models/QueryTest_Entry.php
branches/1.0/tests/models/Rec1.php
branches/1.0/tests/models/Rec2.php
branches/1.0/tests/models/ValidatorTest_Person.php
Log:
Dropped Doctrine_Record_Abstract::ownsOne and
Doctrine_Record_Abstract::ownsMany as scheduled.
Modified: branches/1.0/lib/Doctrine/Record/Abstract.php
===================================================================
--- branches/1.0/lib/Doctrine/Record/Abstract.php 2008-08-27 02:27:34 UTC
(rev 4828)
+++ branches/1.0/lib/Doctrine/Record/Abstract.php 2008-08-27 02:30:02 UTC
(rev 4829)
@@ -183,41 +183,6 @@
}
/**
- * DEPRECATED ALSO? - REMOVE SOON
- *
- * ownsOne
- * binds One-to-One composite relation
- *
- * @param string $componentName the name of the related component
- * @param string $options relation options
- * @see Doctrine_Relation::_$definition
- * @return Doctrine_Record this object
- */
- public function ownsOne()
- {
- $this->_table->bind(func_get_args(), Doctrine_Relation::ONE_COMPOSITE);
-
- return $this;
- }
-
- /**
- * DEPRECATED - REMOVE SOON
- *
- * ownsMany
- * binds One-to-Many / Many-to-Many composite relation
- *
- * @param string $componentName the name of the related component
- * @param string $options relation options
- * @see Doctrine_Relation::_$definition
- * @return Doctrine_Record this object
- */
- public function ownsMany()
- {
- $this->_table->bind(func_get_args(),
Doctrine_Relation::MANY_COMPOSITE);
- return $this;
- }
-
- /**
* hasOne
* binds One-to-One aggregate relation
*
Modified: branches/1.0/lib/Doctrine/Table.php
===================================================================
--- branches/1.0/lib/Doctrine/Table.php 2008-08-27 02:27:34 UTC (rev 4828)
+++ branches/1.0/lib/Doctrine/Table.php 2008-08-27 02:30:02 UTC (rev 4829)
@@ -638,7 +638,7 @@
if ($relation->getTable() === $this &&
in_array($relation->getLocal(), $primary)) {
if ($relation->hasConstraint()) {
- throw new Doctrine_Table_Exception("Badly constructed
integrity constraints.");
+ throw new Doctrine_Table_Exception("Badly constructed
integrity constraints. Cannot define constraint of different fields in the same
table.");
}
continue;
}
Modified: branches/1.0/tests/TableTestCase.php
===================================================================
--- branches/1.0/tests/TableTestCase.php 2008-08-27 02:27:34 UTC (rev
4828)
+++ branches/1.0/tests/TableTestCase.php 2008-08-27 02:30:02 UTC (rev
4829)
@@ -106,7 +106,7 @@
$fk = $this->objTable->getRelation("Email");
$this->assertTrue($fk instanceof Doctrine_Relation_LocalKey);
$this->assertTrue($fk->getTable() instanceof Doctrine_Table);
- $this->assertTrue($fk->getType() == Doctrine_Relation::ONE_COMPOSITE);
+ $this->assertTrue($fk->getType() == Doctrine_Relation::ONE_AGGREGATE);
$this->assertTrue($fk->getLocal() == "email_id");
$this->assertTrue($fk->getForeign() ==
$fk->getTable()->getIdentifier());
Modified: branches/1.0/tests/models/Entity.php
===================================================================
--- branches/1.0/tests/models/Entity.php 2008-08-27 02:27:34 UTC (rev
4828)
+++ branches/1.0/tests/models/Entity.php 2008-08-27 02:30:02 UTC (rev
4829)
@@ -3,9 +3,9 @@
{
public function setUp()
{
- $this->ownsOne('Email', array('local' => 'email_id'));
+ $this->hasOne('Email', array('local' => 'email_id', 'onDelete' =>
'CASCADE'));
$this->hasMany('Phonenumber', array('local' => 'id', 'foreign' =>
'entity_id'));
- $this->ownsOne('Account', array('foreign' => 'entity_id'));
+ $this->hasOne('Account', array('foreign' => 'entity_id', 'onDelete' =>
'CASCADE'));
$this->hasMany('Entity', array('local' => 'entity1',
'refClass' => 'EntityReference',
'foreign' => 'entity2',
Modified: branches/1.0/tests/models/FilterTest.php
===================================================================
--- branches/1.0/tests/models/FilterTest.php 2008-08-27 02:27:34 UTC (rev
4828)
+++ branches/1.0/tests/models/FilterTest.php 2008-08-27 02:30:02 UTC (rev
4829)
@@ -4,6 +4,6 @@
$this->hasColumn('name', 'string',100);
}
public function setUp() {
- $this->ownsMany('FilterTest2 as filtered', 'FilterTest2.test1_id');
+ $this->hasMany('FilterTest2 as filtered', array('local' => 'id',
'foreign' => 'test1_id', 'onDelete' => 'CASCADE'));
}
}
Modified: branches/1.0/tests/models/Package.php
===================================================================
--- branches/1.0/tests/models/Package.php 2008-08-27 02:27:34 UTC (rev
4828)
+++ branches/1.0/tests/models/Package.php 2008-08-27 02:30:02 UTC (rev
4829)
@@ -6,6 +6,6 @@
public function setUp()
{
- $this->ownsMany('PackageVersion as Version',
'PackageVersion.package_id');
+ $this->hasMany('PackageVersion as Version', array('local' => 'id',
'foreign' => 'package_id', 'onDelete' => 'CASCADE'));
}
}
Modified: branches/1.0/tests/models/QueryTest_Board.php
===================================================================
--- branches/1.0/tests/models/QueryTest_Board.php 2008-08-27 02:27:34 UTC
(rev 4828)
+++ branches/1.0/tests/models/QueryTest_Board.php 2008-08-27 02:30:02 UTC
(rev 4829)
@@ -5,7 +5,8 @@
* Initializes the table definition.
*/
public function setTableDefinition()
- {
+ {
+ $this->hasColumn('id', 'integer', 4, array('primary', 'autoincrement',
'notnull'));
$this->hasColumn('categoryId as categoryId', 'integer', 4,
array('notnull'));
$this->hasColumn('name as name', 'string', 100,
@@ -21,7 +22,11 @@
*/
public function setUp()
{
- $this->hasOne('QueryTest_Category as category',
'QueryTest_Board.categoryId');
- $this->ownsOne('QueryTest_Entry as lastEntry',
'QueryTest_Board.lastEntryId');
+ $this->hasOne('QueryTest_Category as category', array(
+ 'local' => 'categoryId', 'foreign' => 'id'
+ ));
+ $this->hasOne('QueryTest_Entry as lastEntry', array(
+ 'local' => 'lastEntryId', 'foreign' => 'id', 'onDelete' =>
'CASCADE'
+ ));
}
}
Modified: branches/1.0/tests/models/QueryTest_Category.php
===================================================================
--- branches/1.0/tests/models/QueryTest_Category.php 2008-08-27 02:27:34 UTC
(rev 4828)
+++ branches/1.0/tests/models/QueryTest_Category.php 2008-08-27 02:30:02 UTC
(rev 4829)
@@ -13,9 +13,10 @@
* Table definition.
*/
public function setTableDefinition()
- {
+ {
+ $this->hasColumn('id', 'integer', 4, array('primary', 'autoincrement',
'notnull'));
$this->hasColumn('rootCategoryId as rootCategoryId', 'integer', 4,
- array('default' => 0));
+ array('notnull', 'default' => 0));
$this->hasColumn('parentCategoryId as parentCategoryId', 'integer', 4,
array('notnull', 'default' => 0));
$this->hasColumn('name as name', 'string', 50,
@@ -29,8 +30,14 @@
*/
public function setUp()
{
- $this->ownsMany('QueryTest_Category as subCategories',
'subCategories.parentCategoryId');
- $this->hasOne('QueryTest_Category as rootCategory',
'QueryTest_Category.rootCategoryId');
- $this->ownsMany('QueryTest_Board as boards',
'QueryTest_Board.categoryId');
+ $this->hasMany('QueryTest_Category as subCategories', array(
+ 'local' => 'id', 'foreign' => 'parentCategoryId'
+ ));
+ $this->hasOne('QueryTest_Category as rootCategory', array(
+ 'local' => 'rootCategoryId', 'foreign' => 'id'
+ ));
+ $this->hasMany('QueryTest_Board as boards', array(
+ 'local' => 'id', 'foreign' => 'categoryId', 'onDelete' => 'CASCADE'
+ ));
}
}
Modified: branches/1.0/tests/models/QueryTest_Entry.php
===================================================================
--- branches/1.0/tests/models/QueryTest_Entry.php 2008-08-27 02:27:34 UTC
(rev 4828)
+++ branches/1.0/tests/models/QueryTest_Entry.php 2008-08-27 02:30:02 UTC
(rev 4829)
@@ -6,6 +6,7 @@
*/
public function setTableDefinition()
{
+ $this->hasColumn('id', 'integer', 4, array('primary', 'autoincrement',
'notnull'));
$this->hasColumn('authorId', 'integer', 4,
array('notnull'));
$this->hasColumn('date', 'integer', 4,
Modified: branches/1.0/tests/models/Rec1.php
===================================================================
--- branches/1.0/tests/models/Rec1.php 2008-08-27 02:27:34 UTC (rev 4828)
+++ branches/1.0/tests/models/Rec1.php 2008-08-27 02:30:02 UTC (rev 4829)
@@ -8,7 +8,7 @@
public function setUp()
{
- $this->ownsOne('Rec2 as Account', array('local' => 'id', 'foreign' =>
'user_id'));
+ $this->hasOne('Rec2 as Account', array('local' => 'id', 'foreign' =>
'user_id', 'onDelete' => 'CASCADE'));
}
}
Modified: branches/1.0/tests/models/Rec2.php
===================================================================
--- branches/1.0/tests/models/Rec2.php 2008-08-27 02:27:34 UTC (rev 4828)
+++ branches/1.0/tests/models/Rec2.php 2008-08-27 02:30:02 UTC (rev 4829)
@@ -9,7 +9,7 @@
public function setUp()
{
- $this->ownsOne('Rec1 as User', 'Rec2.user_id');
+ $this->hasOne('Rec1 as User', array('local' => 'id', 'foreign' =>
'user_id', 'onDelete' => 'CASCADE'));
}
}
Modified: branches/1.0/tests/models/ValidatorTest_Person.php
===================================================================
--- branches/1.0/tests/models/ValidatorTest_Person.php 2008-08-27 02:27:34 UTC
(rev 4828)
+++ branches/1.0/tests/models/ValidatorTest_Person.php 2008-08-27 02:30:02 UTC
(rev 4829)
@@ -6,6 +6,8 @@
}
public function setUp() {
- $this->ownsOne('ValidatorTest_FootballPlayer',
'ValidatorTest_FootballPlayer.person_id');
+ $this->hasOne('ValidatorTest_FootballPlayer', array(
+ 'local' => 'id', 'foreign' => 'person_id', 'onDelete' => 'CASCADE'
+ ));
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---