Changeset 4830

Show
Ignore:
Timestamp:
08/27/08 02:45:11 (10 months ago)
Author:
guilhermeblanco
Message:

Removed Doctrine_Relation::ONE_AGGREGATE, Doctrine_Relation::ONE_AGGREGATE in favor of a single one Doctrine_Relation::ONE.
Removed Doctrine_Relation::MANY_AGGREGATE, Doctrine_Relation::MANY_AGGREGATE in favor of a single one Doctrine_Relation::MANY.
Finished removal of ownsOne and ownsMany.

Location:
branches/1.0
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Import/Builder.php

    r4753 r4830  
    440440                } 
    441441 
    442                 if ($relation['type'] === Doctrine_Relation::ONE || 
    443                     $relation['type'] === Doctrine_Relation::ONE_COMPOSITE) { 
     442                if ($relation['type'] === Doctrine_Relation::ONE) { 
    444443                    $ret[$i] = "    ".'$this->hasOne(\'' . $class . $alias . '\''; 
    445444                } else { 
  • branches/1.0/lib/Doctrine/Record/Abstract.php

    r4829 r4830  
    194194    public function hasOne() 
    195195    { 
    196         $this->_table->bind(func_get_args(), Doctrine_Relation::ONE_AGGREGATE); 
     196        $this->_table->bind(func_get_args(), Doctrine_Relation::ONE); 
    197197 
    198198        return $this; 
     
    210210    public function hasMany() 
    211211    { 
    212         $this->_table->bind(func_get_args(), Doctrine_Relation::MANY_AGGREGATE); 
     212        $this->_table->bind(func_get_args(), Doctrine_Relation::MANY); 
    213213 
    214214        return $this; 
  • branches/1.0/lib/Doctrine/Relation.php

    r4502 r4830  
    3939 
    4040    /** 
    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     */ 
    6043    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; 
    6249     
    6350    // TRUE => mandatory, everything else is just a default value. this should be refactored 
     
    307294 
    308295    /** 
    309      * isComposite 
    310      * returns whether or not this relation is a composite relation 
    311      * 
    312      * @return boolean 
    313      */ 
    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     /** 
    321296     * isOneToOne 
    322297     * returns whether or not this relation is a one-to-one relation 
     
    326301    final public function isOneToOne() 
    327302    { 
    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); 
    330304    } 
    331305 
  • branches/1.0/tests/RecordTestCase.php

    r4818 r4830  
    442442        $fk = $e->getTable()->getRelation("Child"); 
    443443        $this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey); 
    444         $this->assertEqual($fk->getType(), Doctrine_Relation::MANY_AGGREGATE); 
     444        $this->assertEqual($fk->getType(), Doctrine_Relation::MANY); 
    445445        $this->assertEqual($fk->getForeign(), "parent_id"); 
    446446        $this->assertEqual($fk->getLocal(), "id"); 
  • branches/1.0/tests/TableTestCase.php

    r4829 r4830  
    100100        $this->assertTrue($fk instanceof Doctrine_Relation_Association); 
    101101        $this->assertTrue($fk->getTable() instanceof Doctrine_Table); 
    102         $this->assertTrue($fk->getType() == Doctrine_Relation::MANY_AGGREGATE); 
     102        $this->assertTrue($fk->getType() == Doctrine_Relation::MANY); 
    103103        $this->assertTrue($fk->getLocal() == "user_id"); 
    104104        $this->assertTrue($fk->getForeign() == "group_id"); 
     
    107107        $this->assertTrue($fk instanceof Doctrine_Relation_LocalKey); 
    108108        $this->assertTrue($fk->getTable() instanceof Doctrine_Table); 
    109         $this->assertTrue($fk->getType() == Doctrine_Relation::ONE_AGGREGATE); 
     109        $this->assertTrue($fk->getType() == Doctrine_Relation::ONE); 
    110110        $this->assertTrue($fk->getLocal() == "email_id"); 
    111111        $this->assertTrue($fk->getForeign() == $fk->getTable()->getIdentifier());