Changeset 4829

Show
Ignore:
Timestamp:
08/27/08 03:30:02 (5 months ago)
Author:
guilhermeblanco
Message:

Dropped Doctrine_Record_Abstract::ownsOne and Doctrine_Record_Abstract::ownsMany as scheduled.

Location:
branches/1.0
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Record/Abstract.php

    r4778 r4829  
    184184 
    185185    /** 
    186      * DEPRECATED ALSO? - REMOVE SOON 
    187      * 
    188      * ownsOne 
    189      * binds One-to-One composite relation 
    190      * 
    191      * @param string $componentName     the name of the related component 
    192      * @param string $options           relation options 
    193      * @see Doctrine_Relation::_$definition 
    194      * @return Doctrine_Record          this object 
    195      */ 
    196     public function ownsOne() 
    197     { 
    198         $this->_table->bind(func_get_args(), Doctrine_Relation::ONE_COMPOSITE); 
    199          
    200         return $this; 
    201     } 
    202  
    203     /** 
    204      * DEPRECATED - REMOVE SOON 
    205      * 
    206      * ownsMany 
    207      * binds One-to-Many / Many-to-Many composite relation 
    208      * 
    209      * @param string $componentName     the name of the related component 
    210      * @param string $options           relation options 
    211      * @see Doctrine_Relation::_$definition 
    212      * @return Doctrine_Record          this object 
    213      */ 
    214     public function ownsMany() 
    215     { 
    216         $this->_table->bind(func_get_args(), Doctrine_Relation::MANY_COMPOSITE); 
    217         return $this; 
    218     } 
    219  
    220     /** 
    221186     * hasOne 
    222187     * binds One-to-One aggregate relation 
  • branches/1.0/lib/Doctrine/Table.php

    r4823 r4829  
    639639                if ($relation->getTable() === $this && in_array($relation->getLocal(), $primary)) { 
    640640                    if ($relation->hasConstraint()) { 
    641                         throw new Doctrine_Table_Exception("Badly constructed integrity constraints."); 
     641                        throw new Doctrine_Table_Exception("Badly constructed integrity constraints. Cannot define constraint of different fields in the same table."); 
    642642                    } 
    643643                    continue; 
  • branches/1.0/tests/models/Entity.php

    r4121 r4829  
    44    public function setUp()  
    55    { 
    6         $this->ownsOne('Email', array('local' => 'email_id')); 
     6        $this->hasOne('Email', array('local' => 'email_id', 'onDelete' => 'CASCADE')); 
    77        $this->hasMany('Phonenumber', array('local' => 'id', 'foreign' => 'entity_id')); 
    8         $this->ownsOne('Account', array('foreign' => 'entity_id')); 
     8        $this->hasOne('Account', array('foreign' => 'entity_id', 'onDelete' => 'CASCADE')); 
    99        $this->hasMany('Entity', array('local' => 'entity1',  
    1010            'refClass' => 'EntityReference', 
  • branches/1.0/tests/models/FilterTest.php

    r2353 r4829  
    55    } 
    66    public function setUp() { 
    7         $this->ownsMany('FilterTest2 as filtered', 'FilterTest2.test1_id'); 
     7        $this->hasMany('FilterTest2 as filtered', array('local' => 'id', 'foreign' => 'test1_id', 'onDelete' => 'CASCADE')); 
    88    } 
    99} 
  • branches/1.0/tests/models/Package.php

    r2353 r4829  
    77    public function setUp() 
    88    { 
    9         $this->ownsMany('PackageVersion as Version', 'PackageVersion.package_id'); 
     9        $this->hasMany('PackageVersion as Version', array('local' => 'id', 'foreign' => 'package_id', 'onDelete' => 'CASCADE')); 
    1010    } 
    1111} 
  • branches/1.0/tests/models/QueryTest_Board.php

    r4652 r4829  
    66     */ 
    77    public function setTableDefinition() 
    8     {         
     8    { 
     9        $this->hasColumn('id', 'integer', 4, array('primary', 'autoincrement', 'notnull')); 
    910        $this->hasColumn('categoryId as categoryId', 'integer', 4, 
    1011                array('notnull')); 
     
    2223    public function setUp() 
    2324    { 
    24         $this->hasOne('QueryTest_Category as category', 'QueryTest_Board.categoryId'); 
    25         $this->ownsOne('QueryTest_Entry as lastEntry', 'QueryTest_Board.lastEntryId'); 
     25        $this->hasOne('QueryTest_Category as category', array( 
     26            'local' => 'categoryId', 'foreign' => 'id' 
     27        )); 
     28        $this->hasOne('QueryTest_Entry as lastEntry', array( 
     29            'local' => 'lastEntryId', 'foreign' => 'id', 'onDelete' => 'CASCADE' 
     30        )); 
    2631    } 
    2732} 
  • branches/1.0/tests/models/QueryTest_Category.php

    r2963 r4829  
    1414     */ 
    1515    public function setTableDefinition() 
    16     {         
     16    { 
     17        $this->hasColumn('id', 'integer', 4, array('primary', 'autoincrement', 'notnull')); 
    1718        $this->hasColumn('rootCategoryId as rootCategoryId', 'integer', 4, 
    18                 array('default' => 0)); 
     19                array('notnull', 'default' => 0)); 
    1920        $this->hasColumn('parentCategoryId as parentCategoryId', 'integer', 4, 
    2021                array('notnull', 'default' => 0)); 
     
    3031    public function setUp() 
    3132    { 
    32         $this->ownsMany('QueryTest_Category as subCategories', 'subCategories.parentCategoryId'); 
    33         $this->hasOne('QueryTest_Category as rootCategory', 'QueryTest_Category.rootCategoryId'); 
    34         $this->ownsMany('QueryTest_Board as boards', 'QueryTest_Board.categoryId'); 
     33        $this->hasMany('QueryTest_Category as subCategories', array( 
     34            'local' => 'id', 'foreign' => 'parentCategoryId' 
     35        )); 
     36        $this->hasOne('QueryTest_Category as rootCategory', array( 
     37            'local' => 'rootCategoryId', 'foreign' => 'id' 
     38        )); 
     39        $this->hasMany('QueryTest_Board as boards', array( 
     40            'local' => 'id', 'foreign' => 'categoryId', 'onDelete' => 'CASCADE' 
     41        )); 
    3542    } 
    3643} 
  • branches/1.0/tests/models/QueryTest_Entry.php

    r2963 r4829  
    77    public function setTableDefinition() 
    88    {         
     9        $this->hasColumn('id', 'integer', 4, array('primary', 'autoincrement', 'notnull')); 
    910        $this->hasColumn('authorId', 'integer', 4, 
    1011                array('notnull')); 
  • branches/1.0/tests/models/Rec1.php

    r2353 r4829  
    99    public function setUp() 
    1010    { 
    11         $this->ownsOne('Rec2 as Account', array('local' => 'id', 'foreign' => 'user_id')); 
     11        $this->hasOne('Rec2 as Account', array('local' => 'id', 'foreign' => 'user_id', 'onDelete' => 'CASCADE')); 
    1212    } 
    1313} 
  • branches/1.0/tests/models/Rec2.php

    r2353 r4829  
    1010    public function setUp() 
    1111    { 
    12         $this->ownsOne('Rec1 as User', 'Rec2.user_id'); 
     12        $this->hasOne('Rec1 as User', array('local' => 'id', 'foreign' => 'user_id', 'onDelete' => 'CASCADE')); 
    1313    } 
    1414 
  • branches/1.0/tests/models/ValidatorTest_Person.php

    r2353 r4829  
    77    
    88   public function setUp() { 
    9       $this->ownsOne('ValidatorTest_FootballPlayer', 'ValidatorTest_FootballPlayer.person_id'); 
     9      $this->hasOne('ValidatorTest_FootballPlayer', array( 
     10          'local' => 'id', 'foreign' => 'person_id', 'onDelete' => 'CASCADE' 
     11      )); 
    1012   } 
    1113} 
  • branches/1.0/tests/TableTestCase.php

    r3977 r4829  
    107107        $this->assertTrue($fk instanceof Doctrine_Relation_LocalKey); 
    108108        $this->assertTrue($fk->getTable() instanceof Doctrine_Table); 
    109         $this->assertTrue($fk->getType() == Doctrine_Relation::ONE_COMPOSITE); 
     109        $this->assertTrue($fk->getType() == Doctrine_Relation::ONE_AGGREGATE); 
    110110        $this->assertTrue($fk->getLocal() == "email_id"); 
    111111        $this->assertTrue($fk->getForeign() == $fk->getTable()->getIdentifier());