Changeset 4857
- Timestamp:
- 08/29/08 05:42:21 (10 months ago)
- Location:
- branches/1.0
- Files:
-
- 36 modified
-
lib/Doctrine/Table.php (modified) (1 diff)
-
tests/models/App.php (modified) (1 diff)
-
tests/models/App_Category.php (modified) (1 diff)
-
tests/models/App_User.php (modified) (1 diff)
-
tests/models/CPK_Association.php (modified) (1 diff)
-
tests/models/CPK_Test.php (modified) (1 diff)
-
tests/models/CPK_Test2.php (modified) (1 diff)
-
tests/models/Data_File.php (modified) (1 diff)
-
tests/models/File_Owner.php (modified) (1 diff)
-
tests/models/ForeignKeyTest2.php (modified) (1 diff)
-
tests/models/Forum_Category.php (modified) (1 diff)
-
tests/models/Log_Entry.php (modified) (1 diff)
-
tests/models/MyOneThing.php (modified) (1 diff)
-
tests/models/MyOtherThing.php (modified) (1 diff)
-
tests/models/MysqlGroup.php (modified) (1 diff)
-
tests/models/MysqlGroupMember.php (modified) (1 diff)
-
tests/models/MysqlUser.php (modified) (1 diff)
-
tests/models/MyUser.php (modified) (1 diff)
-
tests/models/MyUserOneThing.php (modified) (1 diff)
-
tests/models/MyUserOtherThing.php (modified) (1 diff)
-
tests/models/ORM_AccessControl.php (modified) (1 diff)
-
tests/models/ORM_AccessGroup.php (modified) (1 diff)
-
tests/models/ORM_TestEntry.php (modified) (1 diff)
-
tests/models/ORM_TestItem.php (modified) (1 diff)
-
tests/models/PackageVersion.php (modified) (1 diff)
-
tests/models/PackageVersionNotes.php (modified) (1 diff)
-
tests/models/Photo.php (modified) (1 diff)
-
tests/models/Phototag.php (modified) (1 diff)
-
tests/models/QueryTest_Entry.php (modified) (1 diff)
-
tests/models/QueryTest_Rank.php (modified) (1 diff)
-
tests/models/QueryTest_User.php (modified) (1 diff)
-
tests/models/QueryTest_UserRank.php (modified) (1 diff)
-
tests/models/Record_City.php (modified) (1 diff)
-
tests/models/Record_Country.php (modified) (1 diff)
-
tests/models/Tag.php (modified) (1 diff)
-
tests/models/TreeLeaf.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine/Table.php
r4845 r4857 797 797 public function bind($args, $type) 798 798 { 799 $options = array();799 $options = ( ! isset($args[1])) ? array() : $args[1]; 800 800 $options['type'] = $type; 801 802 if ( ! isset($args[1])) {803 $args[1] = array();804 }805 806 // the following is needed for backwards compatibility807 if (is_string($args[1])) {808 if ( ! isset($args[2])) {809 $args[2] = array();810 } elseif (is_string($args[2])) {811 $args[2] = (array) $args[2];812 }813 814 $classes = array_merge($this->_options['parents'], array($this->getComponentName()));815 816 $e = explode('.', $args[1]);817 if (in_array($e[0], $classes)) {818 if ($options['type'] >= Doctrine_Relation::MANY) {819 $options['foreign'] = $e[1];820 } else {821 $options['local'] = $e[1];822 }823 } else {824 $e2 = explode(' as ', $args[0]);825 if ($e[0] !== $e2[0] && ( ! isset($e2[1]) || $e[0] !== $e2[1])) {826 $options['refClass'] = $e[0];827 }828 829 $options['foreign'] = $e[1];830 }831 832 $options = array_merge($args[2], $options);833 } else {834 $options = array_merge($args[1], $options);835 }836 801 837 802 $this->_parser->bind($args[0], $options); -
branches/1.0/tests/models/App.php
r2353 r4857 7 7 } 8 8 public function setUp() { 9 $this->hasOne('User', 'User.id'); 10 $this->hasMany('App_Category as Category', 'App_Category.id'); 9 $this->hasOne('User', array( 10 'local' => 'user_id', 'foreign' => 'id' 11 )); 12 13 $this->hasOne('App_Category as Category', array( 14 'local' => 'app_category_id', 15 'foreign' => 'id' 16 )); 11 17 } 12 18 } -
branches/1.0/tests/models/App_Category.php
r2353 r4857 6 6 } 7 7 public function setUp() { 8 $this->hasMany('App', 'App.app_category_id'); 9 $this->hasMany('App_Category as Parent', 'App_Category.parent_id'); 8 $this->hasMany('App', array( 9 'local' => 'id', 10 'foreign' => 'app_category_id' 11 )); 12 13 $this->hasMany('App_Category as Parent', array( 14 'local' => 'parent_id', 15 'foreign' => 'id' 16 )); 10 17 } 11 18 } -
branches/1.0/tests/models/App_User.php
r2353 r4857 11 11 } 12 12 public function setUp() { 13 $this->hasMany('App', 'App.user_id'); 13 $this->hasMany('App', array( 14 'local' => 'id', 15 'foreign' => 'user_id' 16 )); 14 17 } 15 18 } -
branches/1.0/tests/models/CPK_Association.php
r2353 r4857 2 2 class CPK_Association extends Doctrine_Record { 3 3 public function setTableDefinition() { 4 $this->hasColumn('test1_id', 'integer', 11, 'primary');5 $this->hasColumn('test2_id', 'integer', 11, 'primary');4 $this->hasColumn('test1_id', 'integer', 11, array('primary' => true)); 5 $this->hasColumn('test2_id', 'integer', 11, array('primary' => true)); 6 6 } 7 7 } -
branches/1.0/tests/models/CPK_Test.php
r2353 r4857 5 5 } 6 6 public function setUp() { 7 $this->hasMany('CPK_Test2 as Test', 'CPK_Association.test2_id'); 7 $this->hasMany('CPK_Test2 as Test', array( 8 'local' => 'test1_id', 9 'foreign' => 'test2_id', 10 'refClass' => 'CPK_Association' 11 )); 8 12 } 9 13 } -
branches/1.0/tests/models/CPK_Test2.php
r2353 r4857 5 5 } 6 6 public function setUp() { 7 $this->hasMany('CPK_Test as Test', 'CPK_Association.test1_id'); 7 $this->hasMany('CPK_Test as Test', array( 8 'local' => 'test2_id', 9 'foreign' => 'test1_id', 10 'refClass' => 'CPK_Association' 11 )); 8 12 } 9 13 } -
branches/1.0/tests/models/Data_File.php
r2353 r4857 6 6 } 7 7 public function setUp() { 8 $this->hasOne('File_Owner', 'Data_File.file_owner_id');8 $this->hasOne('File_Owner', array('local' => 'file_owner_id', 'foreign' => 'id')); 9 9 } 10 10 } -
branches/1.0/tests/models/File_Owner.php
r2353 r4857 5 5 } 6 6 public function setUp() { 7 $this->hasOne('Data_File', 'Data_File.file_owner_id');7 $this->hasOne('Data_File', array('local' => 'id', 'foreign' => 'file_owner_id')); 8 8 } 9 9 } -
branches/1.0/tests/models/ForeignKeyTest2.php
r2353 r4857 7 7 $this->hasColumn('foreignkey', 'integer'); 8 8 9 $this->hasOne('ForeignKeyTest', 'ForeignKeyTest2.foreignkey'); 9 $this->hasOne('ForeignKeyTest', array( 10 'local' => 'foreignKey', 'foreign' => 'id' 11 )); 10 12 } 11 13 } -
branches/1.0/tests/models/Forum_Category.php
r2353 r4857 8 8 } 9 9 public function setUp() { 10 $this->hasMany('Forum_Category as Subcategory', 'Subcategory.parent_category_id'); 11 $this->hasOne('Forum_Category as Parent', 'Forum_Category.parent_category_id'); 12 $this->hasOne('Forum_Category as Rootcategory', 'Forum_Category.root_category_id'); 10 $this->hasMany('Forum_Category as Subcategory', array( 11 'local' => 'id', 12 'foreign' => 'parent_category_id' 13 )); 14 15 $this->hasOne('Forum_Category as Parent', array( 16 'local' => 'parent_category_id', 17 'foreign' => 'id' 18 )); 19 20 $this->hasOne('Forum_Category as Rootcategory', array( 21 'local' => 'root_category_id', 22 'foreign' => 'id' 23 )); 13 24 } 14 25 } -
branches/1.0/tests/models/Log_Entry.php
r2353 r4857 5 5 $this->hasColumn('status_id', 'integer'); 6 6 } 7 7 8 public function setUp() { 8 $this->hasOne('Log_Status', 'Log_Entry.status_id'); 9 $this->hasOne('Log_Status', array( 10 'local' => 'status_id', 'foreign' => 'id' 11 )); 9 12 } 10 13 } -
branches/1.0/tests/models/MyOneThing.php
r2353 r4857 5 5 $this->hasColumn('user_id', 'integer'); 6 6 } 7 7 8 public function setUp() { 8 $this->hasMany('MyUserOneThing', 'MyUserOneThing.one_thing_id'); 9 $this->hasMany('MyUserOneThing', array( 10 'local' => 'id', 'foreign' => 'one_thing_id' 11 )); 12 13 $this->hasOne('MyUser', array( 14 'local' => 'user_id', 'foreign' => 'id' 15 )); 9 16 } 10 17 } -
branches/1.0/tests/models/MyOtherThing.php
r2353 r4857 6 6 } 7 7 public function setUp() { 8 $this->hasMany('MyUserOtherThing', 'MyUserOtherThing.other_thing_id'); 8 $this->hasMany('MyUserOtherThing', array( 9 'local' => 'id', 'foreign' => 'other_thing_id' 10 )); 11 12 $this->hasOne('MyUser', array( 13 'local' => 'user_id', 'foreign' => 'id' 14 )); 9 15 } 10 16 } -
branches/1.0/tests/models/MysqlGroup.php
r2353 r4857 5 5 { 6 6 $this->hasColumn('name', 'string', null); 7 8 $this->hasMany('MysqlUser', 'MysqlGroupMember.user_id'); 7 } 8 9 public function setUp() 10 { 11 $this->hasMany('MysqlUser', array( 12 'local' => 'group_id', 13 'foreign' => 'user_id', 14 'refClass' => 'MysqlGroupMember' 15 )); 9 16 } 10 17 } -
branches/1.0/tests/models/MysqlGroupMember.php
r2353 r4857 4 4 public function setTableDefinition() 5 5 { 6 $this->hasColumn('group_id', 'integer', null, 'primary');7 $this->hasColumn('user_id', 'integer', null, 'primary');6 $this->hasColumn('group_id', 'integer', null, array('primary' => true)); 7 $this->hasColumn('user_id', 'integer', null, array('primary' => true)); 8 8 } 9 9 } -
branches/1.0/tests/models/MysqlUser.php
r2353 r4857 5 5 { 6 6 $this->hasColumn('name', 'string', null); 7 8 $this->hasMany('MysqlGroup', 'MysqlGroupMember.group_id'); 7 } 8 9 public function setUp() 10 { 11 $this->hasMany('MysqlGroup', array( 12 'local' => 'user_id', 13 'foreign' => 'group_id', 14 'refClass' => 'MysqlGroupMember' 15 )); 9 16 } 10 17 } -
branches/1.0/tests/models/MyUser.php
r4033 r4857 9 9 public function setUp() 10 10 { 11 $this->hasMany('MyOneThing', 'MyOneThing.user_id'); 12 $this->hasMany('MyOtherThing', 'MyOtherThing.user_id'); 11 $this->hasMany('MyOneThing', array( 12 'local' => 'id', 'foreign' => 'user_id' 13 )); 14 15 $this->hasMany('MyOtherThing', array( 16 'local' => 'id', 'foreign' => 'user_id' 17 )); 13 18 } 14 19 } -
branches/1.0/tests/models/MyUserOneThing.php
r2353 r4857 5 5 $this->hasColumn('one_thing_id', 'integer'); 6 6 } 7 8 9 public function setUp() 10 { 11 $this->hasOne('MyUser', array( 12 'local' => 'user_id', 'foreign' => 'id' 13 )); 14 15 $this->hasOne('MyOneThing', array( 16 'local' => 'one_thing_id', 'foreign' => 'id' 17 )); 18 } 7 19 } -
branches/1.0/tests/models/MyUserOtherThing.php
r2353 r4857 5 5 $this->hasColumn('other_thing_id', 'integer'); 6 6 } 7 8 9 public function setUp() 10 { 11 $this->hasOne('MyUser', array( 12 'local' => 'user_id', 'foreign' => 'id' 13 )); 14 15 $this->hasOne('MyOtherThing', array( 16 'local' => 'other_thing_id', 'foreign' => 'id' 17 )); 18 } 7 19 } -
branches/1.0/tests/models/ORM_AccessControl.php
r2353 r4857 8 8 public function setUp() 9 9 { 10 $this->hasMany('ORM_AccessGroup as accessGroups', 'ORM_AccessControlsGroups.accessGroupID'); 10 $this->hasMany('ORM_AccessGroup as accessGroups', array( 11 'local' => 'accessControlID', 'foreign' => 'accessGroupID', 'refClass' => 'ORM_AccessControlsGroups' 12 )); 11 13 } 12 14 } -
branches/1.0/tests/models/ORM_AccessGroup.php
r2353 r4857 8 8 public function setUp() 9 9 { 10 $this->hasMany('ORM_AccessControl as accessControls', 'ORM_AccessControlsGroups.accessControlID'); 10 $this->hasMany('ORM_AccessControl as accessControls', array( 11 'local' => 'accessGroupID', 'foreign' => 'accessControlID', 'refClass' => 'ORM_AccessControlsGroups' 12 )); 11 13 } 12 14 } -
branches/1.0/tests/models/ORM_TestEntry.php
r2353 r4857 11 11 12 12 public function setUp() { 13 $this->hasOne('ORM_TestItem', 'ORM_TestEntry.itemID'); 13 $this->hasOne('ORM_TestItem', array( 14 'local' => 'itemID', 'foreign' => 'id' 15 )); 14 16 } 15 17 } -
branches/1.0/tests/models/ORM_TestItem.php
r2353 r4857 9 9 public function setUp() { 10 10 11 $this->hasOne('ORM_TestEntry', 'ORM_TestEntry.itemID'); 11 $this->hasOne('ORM_TestEntry', array( 12 'local' => 'id', 'foreign' => 'itemID' 13 )); 12 14 } 13 15 } -
branches/1.0/tests/models/PackageVersion.php
r2353 r4857 7 7 public function setUp() 8 8 { 9 $this->hasOne('Package', 'PackageVersion.package_id'); 10 $this->hasMany('PackageVersionNotes as Note', 'PackageVersionNotes.package_version_id'); 9 $this->hasOne('Package', array('local' => 'package_id', 'foreign' => 'id')); 10 $this->hasMany('PackageVersionNotes as Note', array( 11 'local' => 'id', 'foreign' => 'package_version_id' 12 )); 11 13 } 12 14 } -
branches/1.0/tests/models/PackageVersionNotes.php
r2353 r4857 9 9 public function setUp() 10 10 { 11 $this->hasOne('PackageVersion', 'PackageVersionNotes.package_version_id'); 11 $this->hasOne('PackageVersion', array( 12 'local' => 'package_version_id', 'foreign' => 'id' 13 )); 12 14 } 13 15 } -
branches/1.0/tests/models/Photo.php
r2353 r4857 2 2 class Photo extends Doctrine_Record { 3 3 public function setUp() { 4 $this->hasMany('Tag', 'Phototag.tag_id'); 4 $this->hasMany('Tag', array( 5 'local' => 'photo_id', 6 'foreign' => 'tag_id', 7 'refClass' => 'Phototag' 8 )); 5 9 } 6 10 public function setTableDefinition() { -
branches/1.0/tests/models/Phototag.php
r2353 r4857 2 2 class Phototag extends Doctrine_Record { 3 3 public function setTableDefinition() { 4 $this->hasColumn('photo_id', 'integer' );5 $this->hasColumn('tag_id', 'integer' );4 $this->hasColumn('photo_id', 'integer', 11, array('primary' => true)); 5 $this->hasColumn('tag_id', 'integer', 11, array('primary' => true)); 6 6 } 7 7 } -
branches/1.0/tests/models/QueryTest_Entry.php
r4829 r4857 19 19 public function setUp() 20 20 { 21 $this->hasOne('QueryTest_User as author', 'QueryTest_Entry.authorId'); 21 $this->hasOne('QueryTest_User as author', array( 22 'local' => 'authorId', 'foreign' => 'id' 23 )); 22 24 } 23 25 } -
branches/1.0/tests/models/QueryTest_Rank.php
r2353 r4857 14 14 array('notnull', 'default' => ' ', 'regexp' => '/^[a-zA-Z0-9_\-]+\.(jpg|gif|png)$/D')); 15 15 } 16 16 17 public function setUp() 17 18 { 18 $this->hasMany('QueryTest_User as users', 'QueryTest_UserRank.userId'); 19 $this->hasMany('QueryTest_User as users', array( 20 'local' => 'rankId', 'foreign' => 'userId', 'refClass' => 'QueryTest_UserRank' 21 )); 19 22 } 20 23 } -
branches/1.0/tests/models/QueryTest_User.php
r2963 r4857 15 15 public function setUp() 16 16 { 17 $this->hasOne('QueryTest_Rank as visibleRank', 'QueryTest_User.visibleRankId'); 18 $this->hasMany('QueryTest_Rank as ranks', 'QueryTest_UserRank.rankId'); 17 $this->hasOne('QueryTest_Rank as visibleRank', array( 18 'local' => 'visibleRankId', 'foreign' => 'id' 19 )); 20 21 $this->hasMany('QueryTest_Rank as ranks', array( 22 'local' => 'userId', 'foreign' => 'rankId', 'refClass' => 'QueryTest_UserRank' 23 )); 19 24 } 20 25 } -
branches/1.0/tests/models/QueryTest_UserRank.php
r2353 r4857 4 4 public function setTableDefinition() 5 5 { 6 $this->hasColumn('rankId', 'integer', 4, array('primary' ));7 $this->hasColumn('userId', 'integer', 4, array('primary' ));6 $this->hasColumn('rankId', 'integer', 4, array('primary' => true)); 7 $this->hasColumn('userId', 'integer', 4, array('primary' => true)); 8 8 } 9 9 } -
branches/1.0/tests/models/Record_City.php
r2353 r4857 6 6 $this->hasColumn('district_id', 'integer'); 7 7 } 8 8 9 public function setUp() { 9 $this->hasOne('Record_Country as Country', 'Record_City.country_id'); 10 $this->hasOne('Record_District as District', 'Record_City.district_id'); 10 $this->hasOne('Record_Country as Country', array( 11 'local' => 'country_id', 'foreign' => 'id' 12 )); 13 14 $this->hasOne('Record_District as District', array( 15 'local' => 'district_id', 'foreign' => 'id' 16 )); 11 17 } 12 18 } -
branches/1.0/tests/models/Record_Country.php
r2353 r4857 5 5 } 6 6 public function setUp() { 7 $this->hasMany('Record_City as City', 'City.country_id'); 7 $this->hasMany('Record_City as City', array( 8 'local' => 'id', 9 'foreign' => 'country_id' 10 )); 8 11 } 9 12 } -
branches/1.0/tests/models/Tag.php
r2353 r4857 2 2 class Tag extends Doctrine_Record { 3 3 public function setUp() { 4 $this->hasMany('Photo', 'Phototag.photo_id'); 4 $this->hasMany('Photo', array( 5 'local' => 'tag_id', 6 'foreign' => 'photo_id', 7 'refClass' => 'Phototag' 8 )); 5 9 } 6 10 public function setTableDefinition() { -
branches/1.0/tests/models/TreeLeaf.php
r2353 r4857 7 7 $this->hasColumn('parent_id', 'integer'); 8 8 } 9 9 10 public function setUp() 10 11 { 11 $this->hasOne('TreeLeaf as Parent', 'TreeLeaf.parent_id'); 12 $this->hasMany('TreeLeaf as Children', 'TreeLeaf.parent_id'); 12 $this->hasOne('TreeLeaf as Parent', array( 13 'local' => 'parent_id', 'foreign' => 'id' 14 )); 15 16 $this->hasMany('TreeLeaf as Children', array( 17 'local' => 'id', 'foreign' => 'parent_id' 18 )); 13 19 } 14 20 }