Changeset 4830
- Timestamp:
- 08/27/08 02:45:11 (10 months ago)
- Location:
- branches/1.0
- Files:
-
- 5 modified
-
lib/Doctrine/Import/Builder.php (modified) (1 diff)
-
lib/Doctrine/Record/Abstract.php (modified) (2 diffs)
-
lib/Doctrine/Relation.php (modified) (3 diffs)
-
tests/RecordTestCase.php (modified) (1 diff)
-
tests/TableTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine/Import/Builder.php
r4753 r4830 440 440 } 441 441 442 if ($relation['type'] === Doctrine_Relation::ONE || 443 $relation['type'] === Doctrine_Relation::ONE_COMPOSITE) { 442 if ($relation['type'] === Doctrine_Relation::ONE) { 444 443 $ret[$i] = " ".'$this->hasOne(\'' . $class . $alias . '\''; 445 444 } else { -
branches/1.0/lib/Doctrine/Record/Abstract.php
r4829 r4830 194 194 public function hasOne() 195 195 { 196 $this->_table->bind(func_get_args(), Doctrine_Relation::ONE _AGGREGATE);196 $this->_table->bind(func_get_args(), Doctrine_Relation::ONE); 197 197 198 198 return $this; … … 210 210 public function hasMany() 211 211 { 212 $this->_table->bind(func_get_args(), Doctrine_Relation::MANY _AGGREGATE);212 $this->_table->bind(func_get_args(), Doctrine_Relation::MANY); 213 213 214 214 return $this; -
branches/1.0/lib/Doctrine/Relation.php
r4502 r4830 39 39 40 40 /** 41 * constant for ONE_TO_ONE and MANY_TO_ONE aggregate relationships 42 */ 43 const ONE_AGGREGATE = 0; 44 45 /** 46 * constant for ONE_TO_ONE and MANY_TO_ONE composite relationships 47 */ 48 const ONE_COMPOSITE = 1; 49 50 /** 51 * constant for MANY_TO_MANY and ONE_TO_MANY aggregate relationships 52 */ 53 const MANY_AGGREGATE = 2; 54 55 /** 56 * constant for MANY_TO_MANY and ONE_TO_MANY composite relationships 57 */ 58 const MANY_COMPOSITE = 3; 59 41 * constant for ONE_TO_ONE and MANY_TO_ONE relationships 42 */ 60 43 const ONE = 0; 61 const MANY = 2; 44 45 /** 46 * constant for MANY_TO_MANY and ONE_TO_MANY relationships 47 */ 48 const MANY = 1; 62 49 63 50 // TRUE => mandatory, everything else is just a default value. this should be refactored … … 307 294 308 295 /** 309 * isComposite310 * returns whether or not this relation is a composite relation311 *312 * @return boolean313 */314 final public function isComposite()315 {316 return ($this->definition['type'] == Doctrine_Relation::ONE_COMPOSITE ||317 $this->definition['type'] == Doctrine_Relation::MANY_COMPOSITE);318 }319 320 /**321 296 * isOneToOne 322 297 * returns whether or not this relation is a one-to-one relation … … 326 301 final public function isOneToOne() 327 302 { 328 return ($this->definition['type'] == Doctrine_Relation::ONE_AGGREGATE || 329 $this->definition['type'] == Doctrine_Relation::ONE_COMPOSITE); 303 return ($this->definition['type'] == Doctrine_Relation::ONE); 330 304 } 331 305 -
branches/1.0/tests/RecordTestCase.php
r4818 r4830 442 442 $fk = $e->getTable()->getRelation("Child"); 443 443 $this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey); 444 $this->assertEqual($fk->getType(), Doctrine_Relation::MANY _AGGREGATE);444 $this->assertEqual($fk->getType(), Doctrine_Relation::MANY); 445 445 $this->assertEqual($fk->getForeign(), "parent_id"); 446 446 $this->assertEqual($fk->getLocal(), "id"); -
branches/1.0/tests/TableTestCase.php
r4829 r4830 100 100 $this->assertTrue($fk instanceof Doctrine_Relation_Association); 101 101 $this->assertTrue($fk->getTable() instanceof Doctrine_Table); 102 $this->assertTrue($fk->getType() == Doctrine_Relation::MANY _AGGREGATE);102 $this->assertTrue($fk->getType() == Doctrine_Relation::MANY); 103 103 $this->assertTrue($fk->getLocal() == "user_id"); 104 104 $this->assertTrue($fk->getForeign() == "group_id"); … … 107 107 $this->assertTrue($fk instanceof Doctrine_Relation_LocalKey); 108 108 $this->assertTrue($fk->getTable() instanceof Doctrine_Table); 109 $this->assertTrue($fk->getType() == Doctrine_Relation::ONE _AGGREGATE);109 $this->assertTrue($fk->getType() == Doctrine_Relation::ONE); 110 110 $this->assertTrue($fk->getLocal() == "email_id"); 111 111 $this->assertTrue($fk->getForeign() == $fk->getTable()->getIdentifier());