Author: guilhermeblanco
Date: 2008-08-29 06:42:21 +0100 (Fri, 29 Aug 2008)
New Revision: 4857
Modified:
branches/1.0/lib/Doctrine/Table.php
branches/1.0/tests/models/App.php
branches/1.0/tests/models/App_Category.php
branches/1.0/tests/models/App_User.php
branches/1.0/tests/models/CPK_Association.php
branches/1.0/tests/models/CPK_Test.php
branches/1.0/tests/models/CPK_Test2.php
branches/1.0/tests/models/Data_File.php
branches/1.0/tests/models/File_Owner.php
branches/1.0/tests/models/ForeignKeyTest2.php
branches/1.0/tests/models/Forum_Category.php
branches/1.0/tests/models/Log_Entry.php
branches/1.0/tests/models/MyOneThing.php
branches/1.0/tests/models/MyOtherThing.php
branches/1.0/tests/models/MyUser.php
branches/1.0/tests/models/MyUserOneThing.php
branches/1.0/tests/models/MyUserOtherThing.php
branches/1.0/tests/models/MysqlGroup.php
branches/1.0/tests/models/MysqlGroupMember.php
branches/1.0/tests/models/MysqlUser.php
branches/1.0/tests/models/ORM_AccessControl.php
branches/1.0/tests/models/ORM_AccessGroup.php
branches/1.0/tests/models/ORM_TestEntry.php
branches/1.0/tests/models/ORM_TestItem.php
branches/1.0/tests/models/PackageVersion.php
branches/1.0/tests/models/PackageVersionNotes.php
branches/1.0/tests/models/Photo.php
branches/1.0/tests/models/Phototag.php
branches/1.0/tests/models/QueryTest_Entry.php
branches/1.0/tests/models/QueryTest_Rank.php
branches/1.0/tests/models/QueryTest_User.php
branches/1.0/tests/models/QueryTest_UserRank.php
branches/1.0/tests/models/Record_City.php
branches/1.0/tests/models/Record_Country.php
branches/1.0/tests/models/Tag.php
branches/1.0/tests/models/TreeLeaf.php
Log:
Dropped hasOne(string, string) and hasMany(string, string) in favor to
hasOne(string, array) and hasMany(string, array) support. Backward
compatibility (<= 0.9) is not supported anymore.
Modified: branches/1.0/lib/Doctrine/Table.php
===================================================================
--- branches/1.0/lib/Doctrine/Table.php 2008-08-28 17:30:51 UTC (rev 4856)
+++ branches/1.0/lib/Doctrine/Table.php 2008-08-29 05:42:21 UTC (rev 4857)
@@ -796,44 +796,9 @@
*/
public function bind($args, $type)
{
- $options = array();
+ $options = ( ! isset($args[1])) ? array() : $args[1];
$options['type'] = $type;
- if ( ! isset($args[1])) {
- $args[1] = array();
- }
-
- // the following is needed for backwards compatibility
- if (is_string($args[1])) {
- if ( ! isset($args[2])) {
- $args[2] = array();
- } elseif (is_string($args[2])) {
- $args[2] = (array) $args[2];
- }
-
- $classes = array_merge($this->_options['parents'],
array($this->getComponentName()));
-
- $e = explode('.', $args[1]);
- if (in_array($e[0], $classes)) {
- if ($options['type'] >= Doctrine_Relation::MANY) {
- $options['foreign'] = $e[1];
- } else {
- $options['local'] = $e[1];
- }
- } else {
- $e2 = explode(' as ', $args[0]);
- if ($e[0] !== $e2[0] && ( ! isset($e2[1]) || $e[0] !==
$e2[1])) {
- $options['refClass'] = $e[0];
- }
-
- $options['foreign'] = $e[1];
- }
-
- $options = array_merge($args[2], $options);
- } else {
- $options = array_merge($args[1], $options);
- }
-
$this->_parser->bind($args[0], $options);
}
Modified: branches/1.0/tests/models/App.php
===================================================================
--- branches/1.0/tests/models/App.php 2008-08-28 17:30:51 UTC (rev 4856)
+++ branches/1.0/tests/models/App.php 2008-08-29 05:42:21 UTC (rev 4857)
@@ -6,8 +6,14 @@
$this->hasColumn('app_category_id', 'integer', 11);
}
public function setUp() {
- $this->hasOne('User', 'User.id');
- $this->hasMany('App_Category as Category', 'App_Category.id');
+ $this->hasOne('User', array(
+ 'local' => 'user_id', 'foreign' => 'id'
+ ));
+
+ $this->hasOne('App_Category as Category', array(
+ 'local' => 'app_category_id',
+ 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/App_Category.php
===================================================================
--- branches/1.0/tests/models/App_Category.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/App_Category.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -5,7 +5,14 @@
$this->hasColumn('parent_id', 'integer');
}
public function setUp() {
- $this->hasMany('App', 'App.app_category_id');
- $this->hasMany('App_Category as Parent', 'App_Category.parent_id');
+ $this->hasMany('App', array(
+ 'local' => 'id',
+ 'foreign' => 'app_category_id'
+ ));
+
+ $this->hasMany('App_Category as Parent', array(
+ 'local' => 'parent_id',
+ 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/App_User.php
===================================================================
--- branches/1.0/tests/models/App_User.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/App_User.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -10,6 +10,9 @@
$this->hasColumn('zipcode', 'string', 9, 'nospace');
}
public function setUp() {
- $this->hasMany('App', 'App.user_id');
+ $this->hasMany('App', array(
+ 'local' => 'id',
+ 'foreign' => 'user_id'
+ ));
}
}
Modified: branches/1.0/tests/models/CPK_Association.php
===================================================================
--- branches/1.0/tests/models/CPK_Association.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/CPK_Association.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -1,7 +1,7 @@
<?php
class CPK_Association extends Doctrine_Record {
public function setTableDefinition() {
- $this->hasColumn('test1_id', 'integer', 11, 'primary');
- $this->hasColumn('test2_id', 'integer', 11, 'primary');
+ $this->hasColumn('test1_id', 'integer', 11, array('primary' => true));
+ $this->hasColumn('test2_id', 'integer', 11, array('primary' => true));
}
}
Modified: branches/1.0/tests/models/CPK_Test.php
===================================================================
--- branches/1.0/tests/models/CPK_Test.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/CPK_Test.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,6 +4,10 @@
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
- $this->hasMany('CPK_Test2 as Test', 'CPK_Association.test2_id');
+ $this->hasMany('CPK_Test2 as Test', array(
+ 'local' => 'test1_id',
+ 'foreign' => 'test2_id',
+ 'refClass' => 'CPK_Association'
+ ));
}
}
Modified: branches/1.0/tests/models/CPK_Test2.php
===================================================================
--- branches/1.0/tests/models/CPK_Test2.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/CPK_Test2.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,6 +4,10 @@
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
- $this->hasMany('CPK_Test as Test', 'CPK_Association.test1_id');
+ $this->hasMany('CPK_Test as Test', array(
+ 'local' => 'test2_id',
+ 'foreign' => 'test1_id',
+ 'refClass' => 'CPK_Association'
+ ));
}
}
Modified: branches/1.0/tests/models/Data_File.php
===================================================================
--- branches/1.0/tests/models/Data_File.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/Data_File.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -5,6 +5,6 @@
$this->hasColumn('file_owner_id', 'integer');
}
public function setUp() {
- $this->hasOne('File_Owner', 'Data_File.file_owner_id');
+ $this->hasOne('File_Owner', array('local' => 'file_owner_id',
'foreign' => 'id'));
}
}
Modified: branches/1.0/tests/models/File_Owner.php
===================================================================
--- branches/1.0/tests/models/File_Owner.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/File_Owner.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,6 +4,6 @@
$this->hasColumn('name', 'string', 255);
}
public function setUp() {
- $this->hasOne('Data_File', 'Data_File.file_owner_id');
+ $this->hasOne('Data_File', array('local' => 'id', 'foreign' =>
'file_owner_id'));
}
}
Modified: branches/1.0/tests/models/ForeignKeyTest2.php
===================================================================
--- branches/1.0/tests/models/ForeignKeyTest2.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/ForeignKeyTest2.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -6,6 +6,8 @@
$this->hasColumn('name', 'string', null);
$this->hasColumn('foreignkey', 'integer');
- $this->hasOne('ForeignKeyTest', 'ForeignKeyTest2.foreignkey');
+ $this->hasOne('ForeignKeyTest', array(
+ 'local' => 'foreignKey', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/Forum_Category.php
===================================================================
--- branches/1.0/tests/models/Forum_Category.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/Forum_Category.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -7,8 +7,19 @@
$this->hasColumn('description', 'string', 99999);
}
public function setUp() {
- $this->hasMany('Forum_Category as Subcategory',
'Subcategory.parent_category_id');
- $this->hasOne('Forum_Category as Parent',
'Forum_Category.parent_category_id');
- $this->hasOne('Forum_Category as Rootcategory',
'Forum_Category.root_category_id');
+ $this->hasMany('Forum_Category as Subcategory', array(
+ 'local' => 'id',
+ 'foreign' => 'parent_category_id'
+ ));
+
+ $this->hasOne('Forum_Category as Parent', array(
+ 'local' => 'parent_category_id',
+ 'foreign' => 'id'
+ ));
+
+ $this->hasOne('Forum_Category as Rootcategory', array(
+ 'local' => 'root_category_id',
+ 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/Log_Entry.php
===================================================================
--- branches/1.0/tests/models/Log_Entry.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/Log_Entry.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,7 +4,10 @@
$this->hasColumn('stamp', 'timestamp');
$this->hasColumn('status_id', 'integer');
}
+
public function setUp() {
- $this->hasOne('Log_Status', 'Log_Entry.status_id');
+ $this->hasOne('Log_Status', array(
+ 'local' => 'status_id', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/MyOneThing.php
===================================================================
--- branches/1.0/tests/models/MyOneThing.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/MyOneThing.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,7 +4,14 @@
$this->hasColumn('name', 'string');
$this->hasColumn('user_id', 'integer');
}
+
public function setUp() {
- $this->hasMany('MyUserOneThing', 'MyUserOneThing.one_thing_id');
+ $this->hasMany('MyUserOneThing', array(
+ 'local' => 'id', 'foreign' => 'one_thing_id'
+ ));
+
+ $this->hasOne('MyUser', array(
+ 'local' => 'user_id', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/MyOtherThing.php
===================================================================
--- branches/1.0/tests/models/MyOtherThing.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/MyOtherThing.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -5,6 +5,12 @@
$this->hasColumn('user_id', 'integer');
}
public function setUp() {
- $this->hasMany('MyUserOtherThing',
'MyUserOtherThing.other_thing_id');
+ $this->hasMany('MyUserOtherThing', array(
+ 'local' => 'id', 'foreign' => 'other_thing_id'
+ ));
+
+ $this->hasOne('MyUser', array(
+ 'local' => 'user_id', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/MyUser.php
===================================================================
--- branches/1.0/tests/models/MyUser.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/MyUser.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -8,7 +8,12 @@
public function setUp()
{
- $this->hasMany('MyOneThing', 'MyOneThing.user_id');
- $this->hasMany('MyOtherThing', 'MyOtherThing.user_id');
+ $this->hasMany('MyOneThing', array(
+ 'local' => 'id', 'foreign' => 'user_id'
+ ));
+
+ $this->hasMany('MyOtherThing', array(
+ 'local' => 'id', 'foreign' => 'user_id'
+ ));
}
}
\ No newline at end of file
Modified: branches/1.0/tests/models/MyUserOneThing.php
===================================================================
--- branches/1.0/tests/models/MyUserOneThing.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/MyUserOneThing.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -4,4 +4,16 @@
$this->hasColumn('user_id', 'integer');
$this->hasColumn('one_thing_id', 'integer');
}
+
+
+ public function setUp()
+ {
+ $this->hasOne('MyUser', array(
+ 'local' => 'user_id', 'foreign' => 'id'
+ ));
+
+ $this->hasOne('MyOneThing', array(
+ 'local' => 'one_thing_id', 'foreign' => 'id'
+ ));
+ }
}
Modified: branches/1.0/tests/models/MyUserOtherThing.php
===================================================================
--- branches/1.0/tests/models/MyUserOtherThing.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/MyUserOtherThing.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -4,4 +4,16 @@
$this->hasColumn('user_id', 'integer');
$this->hasColumn('other_thing_id', 'integer');
}
+
+
+ public function setUp()
+ {
+ $this->hasOne('MyUser', array(
+ 'local' => 'user_id', 'foreign' => 'id'
+ ));
+
+ $this->hasOne('MyOtherThing', array(
+ 'local' => 'other_thing_id', 'foreign' => 'id'
+ ));
+ }
}
Modified: branches/1.0/tests/models/MysqlGroup.php
===================================================================
--- branches/1.0/tests/models/MysqlGroup.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/MysqlGroup.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,7 +4,14 @@
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
-
- $this->hasMany('MysqlUser', 'MysqlGroupMember.user_id');
}
+
+ public function setUp()
+ {
+ $this->hasMany('MysqlUser', array(
+ 'local' => 'group_id',
+ 'foreign' => 'user_id',
+ 'refClass' => 'MysqlGroupMember'
+ ));
+ }
}
Modified: branches/1.0/tests/models/MysqlGroupMember.php
===================================================================
--- branches/1.0/tests/models/MysqlGroupMember.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/MysqlGroupMember.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -3,8 +3,8 @@
{
public function setTableDefinition()
{
- $this->hasColumn('group_id', 'integer', null, 'primary');
- $this->hasColumn('user_id', 'integer', null, 'primary');
+ $this->hasColumn('group_id', 'integer', null, array('primary' =>
true));
+ $this->hasColumn('user_id', 'integer', null, array('primary' => true));
}
}
Modified: branches/1.0/tests/models/MysqlUser.php
===================================================================
--- branches/1.0/tests/models/MysqlUser.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/MysqlUser.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -4,7 +4,14 @@
public function setTableDefinition()
{
$this->hasColumn('name', 'string', null);
-
- $this->hasMany('MysqlGroup', 'MysqlGroupMember.group_id');
}
+
+ public function setUp()
+ {
+ $this->hasMany('MysqlGroup', array(
+ 'local' => 'user_id',
+ 'foreign' => 'group_id',
+ 'refClass' => 'MysqlGroupMember'
+ ));
+ }
}
Modified: branches/1.0/tests/models/ORM_AccessControl.php
===================================================================
--- branches/1.0/tests/models/ORM_AccessControl.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/ORM_AccessControl.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -7,6 +7,8 @@
}
public function setUp()
{
- $this->hasMany('ORM_AccessGroup as accessGroups',
'ORM_AccessControlsGroups.accessGroupID');
+ $this->hasMany('ORM_AccessGroup as accessGroups', array(
+ 'local' => 'accessControlID', 'foreign' => 'accessGroupID',
'refClass' => 'ORM_AccessControlsGroups'
+ ));
}
}
Modified: branches/1.0/tests/models/ORM_AccessGroup.php
===================================================================
--- branches/1.0/tests/models/ORM_AccessGroup.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/ORM_AccessGroup.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -7,6 +7,8 @@
}
public function setUp()
{
- $this->hasMany('ORM_AccessControl as accessControls',
'ORM_AccessControlsGroups.accessControlID');
+ $this->hasMany('ORM_AccessControl as accessControls', array(
+ 'local' => 'accessGroupID', 'foreign' => 'accessControlID',
'refClass' => 'ORM_AccessControlsGroups'
+ ));
}
}
Modified: branches/1.0/tests/models/ORM_TestEntry.php
===================================================================
--- branches/1.0/tests/models/ORM_TestEntry.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/ORM_TestEntry.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -10,6 +10,8 @@
}
public function setUp() {
- $this->hasOne('ORM_TestItem', 'ORM_TestEntry.itemID');
+ $this->hasOne('ORM_TestItem', array(
+ 'local' => 'itemID', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/ORM_TestItem.php
===================================================================
--- branches/1.0/tests/models/ORM_TestItem.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/ORM_TestItem.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -8,6 +8,8 @@
public function setUp() {
- $this->hasOne('ORM_TestEntry', 'ORM_TestEntry.itemID');
+ $this->hasOne('ORM_TestEntry', array(
+ 'local' => 'id', 'foreign' => 'itemID'
+ ));
}
}
Modified: branches/1.0/tests/models/PackageVersion.php
===================================================================
--- branches/1.0/tests/models/PackageVersion.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/PackageVersion.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -6,7 +6,9 @@
}
public function setUp()
{
- $this->hasOne('Package', 'PackageVersion.package_id');
- $this->hasMany('PackageVersionNotes as Note',
'PackageVersionNotes.package_version_id');
+ $this->hasOne('Package', array('local' => 'package_id', 'foreign' =>
'id'));
+ $this->hasMany('PackageVersionNotes as Note', array(
+ 'local' => 'id', 'foreign' => 'package_version_id'
+ ));
}
}
Modified: branches/1.0/tests/models/PackageVersionNotes.php
===================================================================
--- branches/1.0/tests/models/PackageVersionNotes.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/PackageVersionNotes.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -8,6 +8,8 @@
}
public function setUp()
{
- $this->hasOne('PackageVersion',
'PackageVersionNotes.package_version_id');
+ $this->hasOne('PackageVersion', array(
+ 'local' => 'package_version_id', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/Photo.php
===================================================================
--- branches/1.0/tests/models/Photo.php 2008-08-28 17:30:51 UTC (rev 4856)
+++ branches/1.0/tests/models/Photo.php 2008-08-29 05:42:21 UTC (rev 4857)
@@ -1,7 +1,11 @@
<?php
class Photo extends Doctrine_Record {
public function setUp() {
- $this->hasMany('Tag', 'Phototag.tag_id');
+ $this->hasMany('Tag', array(
+ 'local' => 'photo_id',
+ 'foreign' => 'tag_id',
+ 'refClass' => 'Phototag'
+ ));
}
public function setTableDefinition() {
$this->hasColumn('name', 'string', 100);
Modified: branches/1.0/tests/models/Phototag.php
===================================================================
--- branches/1.0/tests/models/Phototag.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/Phototag.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -1,7 +1,7 @@
<?php
class Phototag extends Doctrine_Record {
public function setTableDefinition() {
- $this->hasColumn('photo_id', 'integer');
- $this->hasColumn('tag_id', 'integer');
+ $this->hasColumn('photo_id', 'integer', 11, array('primary' => true));
+ $this->hasColumn('tag_id', 'integer', 11, array('primary' => true));
}
}
Modified: branches/1.0/tests/models/QueryTest_Entry.php
===================================================================
--- branches/1.0/tests/models/QueryTest_Entry.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/QueryTest_Entry.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -18,6 +18,8 @@
*/
public function setUp()
{
- $this->hasOne('QueryTest_User as author', 'QueryTest_Entry.authorId');
+ $this->hasOne('QueryTest_User as author', array(
+ 'local' => 'authorId', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/QueryTest_Rank.php
===================================================================
--- branches/1.0/tests/models/QueryTest_Rank.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/QueryTest_Rank.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -13,8 +13,11 @@
$this->hasColumn('icon as icon', 'string', 50,
array('notnull', 'default' => ' ', 'regexp' =>
'/^[a-zA-Z0-9_\-]+\.(jpg|gif|png)$/D'));
}
+
public function setUp()
{
- $this->hasMany('QueryTest_User as users', 'QueryTest_UserRank.userId');
+ $this->hasMany('QueryTest_User as users', array(
+ 'local' => 'rankId', 'foreign' => 'userId', 'refClass' =>
'QueryTest_UserRank'
+ ));
}
}
Modified: branches/1.0/tests/models/QueryTest_User.php
===================================================================
--- branches/1.0/tests/models/QueryTest_User.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/QueryTest_User.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -14,7 +14,12 @@
*/
public function setUp()
{
- $this->hasOne('QueryTest_Rank as visibleRank',
'QueryTest_User.visibleRankId');
- $this->hasMany('QueryTest_Rank as ranks', 'QueryTest_UserRank.rankId');
+ $this->hasOne('QueryTest_Rank as visibleRank', array(
+ 'local' => 'visibleRankId', 'foreign' => 'id'
+ ));
+
+ $this->hasMany('QueryTest_Rank as ranks', array(
+ 'local' => 'userId', 'foreign' => 'rankId', 'refClass' =>
'QueryTest_UserRank'
+ ));
}
}
Modified: branches/1.0/tests/models/QueryTest_UserRank.php
===================================================================
--- branches/1.0/tests/models/QueryTest_UserRank.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/QueryTest_UserRank.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -3,7 +3,7 @@
{
public function setTableDefinition()
{
- $this->hasColumn('rankId', 'integer', 4, array('primary'));
- $this->hasColumn('userId', 'integer', 4, array('primary'));
+ $this->hasColumn('rankId', 'integer', 4, array('primary' => true));
+ $this->hasColumn('userId', 'integer', 4, array('primary' => true));
}
}
Modified: branches/1.0/tests/models/Record_City.php
===================================================================
--- branches/1.0/tests/models/Record_City.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/Record_City.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -5,8 +5,14 @@
$this->hasColumn('country_id', 'integer');
$this->hasColumn('district_id', 'integer');
}
+
public function setUp() {
- $this->hasOne('Record_Country as Country', 'Record_City.country_id');
- $this->hasOne('Record_District as District',
'Record_City.district_id');
+ $this->hasOne('Record_Country as Country', array(
+ 'local' => 'country_id', 'foreign' => 'id'
+ ));
+
+ $this->hasOne('Record_District as District', array(
+ 'local' => 'district_id', 'foreign' => 'id'
+ ));
}
}
Modified: branches/1.0/tests/models/Record_Country.php
===================================================================
--- branches/1.0/tests/models/Record_Country.php 2008-08-28 17:30:51 UTC
(rev 4856)
+++ branches/1.0/tests/models/Record_Country.php 2008-08-29 05:42:21 UTC
(rev 4857)
@@ -4,7 +4,10 @@
$this->hasColumn('name', 'string', 200);
}
public function setUp() {
- $this->hasMany('Record_City as City', 'City.country_id');
+ $this->hasMany('Record_City as City', array(
+ 'local' => 'id',
+ 'foreign' => 'country_id'
+ ));
}
}
Modified: branches/1.0/tests/models/Tag.php
===================================================================
--- branches/1.0/tests/models/Tag.php 2008-08-28 17:30:51 UTC (rev 4856)
+++ branches/1.0/tests/models/Tag.php 2008-08-29 05:42:21 UTC (rev 4857)
@@ -1,7 +1,11 @@
<?php
class Tag extends Doctrine_Record {
public function setUp() {
- $this->hasMany('Photo', 'Phototag.photo_id');
+ $this->hasMany('Photo', array(
+ 'local' => 'tag_id',
+ 'foreign' => 'photo_id',
+ 'refClass' => 'Phototag'
+ ));
}
public function setTableDefinition() {
$this->hasColumn('tag', 'string', 100);
Modified: branches/1.0/tests/models/TreeLeaf.php
===================================================================
--- branches/1.0/tests/models/TreeLeaf.php 2008-08-28 17:30:51 UTC (rev
4856)
+++ branches/1.0/tests/models/TreeLeaf.php 2008-08-29 05:42:21 UTC (rev
4857)
@@ -6,9 +6,15 @@
$this->hasColumn('name', 'string');
$this->hasColumn('parent_id', 'integer');
}
+
public function setUp()
{
- $this->hasOne('TreeLeaf as Parent', 'TreeLeaf.parent_id');
- $this->hasMany('TreeLeaf as Children', 'TreeLeaf.parent_id');
+ $this->hasOne('TreeLeaf as Parent', array(
+ 'local' => 'parent_id', 'foreign' => 'id'
+ ));
+
+ $this->hasMany('TreeLeaf as Children', array(
+ 'local' => 'id', 'foreign' => 'parent_id'
+ ));
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---