Changeset 4681

Show
Ignore:
Timestamp:
07/13/08 01:04:42 (5 months ago)
Author:
jwage
Message:

fixes #1181 - removing loadTemplate() in favor of using actAs() always for loading behaviors, templates, etc.

Location:
branches/1.0
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/docs/manual/de/class-templates.txt

    r4674 r4681  
    4444</code> 
    4545 
    46 Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add loadTemplate()  
     46Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add actAs()  
    4747call in the class definition. 
    4848 
     
    5757    public function setUp() 
    5858    { 
    59         $this->loadTemplate('TimestampTemplate'); 
     59        $this->actAs('TimestampTemplate'); 
    6060    } 
    6161} 
     
    140140    public function setUp() 
    141141    { 
    142         $this->loadTemplate('UserTemplate'); 
     142        $this->actAs('UserTemplate'); 
    143143    } 
    144144} 
     
    147147    public function setUp() 
    148148    { 
    149         $this->loadTemplate('EmailTemplate'); 
     149        $this->actAs('EmailTemplate'); 
    150150    } 
    151151} 
     
    191191    public function setUp() 
    192192    { 
    193         $this->loadTemplate('AuthTemplate'); 
     193        $this->actAs('AuthTemplate'); 
    194194    } 
    195195} 
  • branches/1.0/docs/manual/de/hierarchical-data/nested-set.txt

    r4674 r4681  
    3737        ... 
    3838 
    39         $this->loadTemplate('Doctrine_Template_NestedSet');        
     39        $this->actAs('Doctrine_Template_NestedSet');        
    4040 
    4141       ... 
  • branches/1.0/docs/manual/en/behaviors.txt

    r4678 r4681  
    618618</code> 
    619619 
    620 Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add loadTemplate()  
     620Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add actAs()  
    621621call in the class definition. 
    622622 
     
    631631    public function setUp() 
    632632    { 
    633         $this->loadTemplate('TimestampTemplate'); 
     633        $this->actAs('TimestampTemplate'); 
    634634    } 
    635635} 
     
    714714    public function setUp() 
    715715    { 
    716         $this->loadTemplate('UserTemplate'); 
     716        $this->actAs('UserTemplate'); 
    717717    } 
    718718} 
     
    721721    public function setUp() 
    722722    { 
    723         $this->loadTemplate('EmailTemplate'); 
     723        $this->actAs('EmailTemplate'); 
    724724    } 
    725725} 
     
    765765    public function setUp() 
    766766    { 
    767         $this->loadTemplate('AuthTemplate'); 
     767        $this->actAs('AuthTemplate'); 
    768768    } 
    769769} 
  • branches/1.0/docs/manual/en/hierarchical-data/nested-set.txt

    r4674 r4681  
    3737        ... 
    3838 
    39         $this->loadTemplate('Doctrine_Template_NestedSet');        
     39        $this->actAs('Doctrine_Template_NestedSet');        
    4040 
    4141       ... 
  • branches/1.0/docs/manual/ja/class-templates.txt

    r4674 r4681  
    4343タむムスタンプの機胜を忠
    4444芁ずするBlogず呌ばれるクラスを考えおみたしょう。忠
    45 èŠãªã“ãšã¯loadTemplate()コヌルをクラス定矩に远加するこずです。 
     45芁なこずはactAs()コヌルをクラス定矩に远加するこずです。 
    4646 
    4747<code type="php"> 
     
    5555    public function setUp() 
    5656    { 
    57         $this->loadTemplate('TimestampTemplate'); 
     57        $this->actAs('TimestampTemplate'); 
    5858    } 
    5959} 
     
    137137    public function setUp() 
    138138    { 
    139         $this->loadTemplate('UserTemplate'); 
     139        $this->actAs('UserTemplate'); 
    140140    } 
    141141} 
     
    144144    public function setUp() 
    145145    { 
    146         $this->loadTemplate('EmailTemplate'); 
     146        $this->actAs('EmailTemplate'); 
    147147    } 
    148148} 
     
    192192    public function setUp() 
    193193    { 
    194         $this->loadTemplate('AuthTemplate'); 
     194        $this->actAs('AuthTemplate'); 
    195195    } 
    196196} 
  • branches/1.0/docs/manual/ja/hierarchical-data.txt

    r4674 r4681  
    7070        ... 
    7171 
    72         $this->loadTemplate('Doctrine_Template_NestedSet');        
     72        $this->actAs('Doctrine_Template_NestedSet');        
    7373 
    7474       ... 
  • branches/1.0/lib/Doctrine/Import/Builder.php

    r4679 r4681  
    487487        } 
    488488 
    489         if (isset($definition['templates']) && is_array($definition['templates']) && !empty($definition['templates'])) { 
    490             $ret[$i] = $this->buildTemplates($definition['templates']); 
    491             $i++; 
    492         } 
    493  
    494489        if (isset($definition['actAs']) && is_array($definition['actAs']) && !empty($definition['actAs'])) { 
    495490            $ret[$i] = $this->buildActAs($definition['actAs']); 
     
    620615 
    621616        return $ret; 
    622     } 
    623  
    624     /** 
    625      * buildTemplates 
    626      * 
    627      * @param string $array 
    628      * @return void 
    629      */ 
    630     public function buildTemplates(array $templates) 
    631     { 
    632         $build = ''; 
    633         foreach ($templates as $name => $options) { 
    634  
    635             if (is_array($options) && !empty($options)) { 
    636                 $optionsPhp = $this->varExport($options); 
    637  
    638                 $build .= "    \$this->loadTemplate('" . $name . "', " . $optionsPhp . ");" . PHP_EOL; 
    639             } else { 
    640                 if (isset($templates[0])) { 
    641                     $build .= "    \$this->loadTemplate('" . $options . "');" . PHP_EOL; 
    642                 } else { 
    643                     $build .= "    \$this->loadTemplate('" . $name . "');" . PHP_EOL; 
    644                 } 
    645             } 
    646         } 
    647  
    648         return $build; 
    649617    } 
    650618 
  • branches/1.0/lib/Doctrine/Record/Abstract.php

    r4460 r4681  
    269269            $this->hasColumn($name, $options['type'], $options['length'], $options); 
    270270        } 
    271     }  
    272     /** 
    273      * loadTemplate 
    274      * 
    275      * @param string $template 
    276      */ 
    277     public function loadTemplate($template, array $options = array()) 
    278     { 
    279         $this->actAs($template, $options); 
    280271    } 
    281272 
  • branches/1.0/tests/models/Blog.php

    r2588 r4681  
    88    public function setUp() 
    99    { 
    10         $this->loadTemplate('Taggable'); 
     10        $this->actAs('Taggable'); 
    1111    } 
    1212} 
  • branches/1.0/tests/models/ConcreteEmail.php

    r2353 r4681  
    44    public function setUp() 
    55    { 
    6         $this->loadTemplate('EmailTemplate'); 
     6        $this->actAs('EmailTemplate'); 
    77    } 
    88} 
  • branches/1.0/tests/models/ConcreteGroup.php

    r2353 r4681  
    44    public function setUp() 
    55    { 
    6         $this->loadTemplate('GroupTemplate'); 
     6        $this->actAs('GroupTemplate'); 
    77    } 
    88} 
  • branches/1.0/tests/models/ConcreteGroupUser.php

    r2353 r4681  
    44    public function setUp() 
    55    { 
    6         $this->loadTemplate('GroupUserTemplate'); 
     6        $this->actAs('GroupUserTemplate'); 
    77    } 
    88} 
  • branches/1.0/tests/models/ConcreteUser.php

    r2353 r4681  
    44    public function setUp() 
    55    { 
    6         $this->loadTemplate('UserTemplate'); 
     6        $this->actAs('UserTemplate'); 
    77    } 
    88} 
  • branches/1.0/tests/RawSqlTestCase.php

    r3884 r4681  
    4040        $query->parseQuery($sql); 
    4141         
    42         $this->assertEqual($query->getQueryPart('from'), array('photos p')); 
     42        $this->assertEqual($query->getSqlQueryPart('from'), array('photos p')); 
    4343 
    4444 
     
    4646        $query->parseQuery($sql); 
    4747 
    48         $this->assertEqual($query->getQueryPart('from'), array('(SELECT p.* FROM photos p LEFT JOIN photos_tags t ON t.photo_id = p.id WHERE t.tag_id = 65) p LEFT JOIN photos_tags t ON t.photo_id = p.id')); 
    49         $this->assertEqual($query->getQueryPart('where'), array('p.can_see = -1 AND t.tag_id = 62')); 
    50         $this->assertEqual($query->getQueryPart('limit'), array(200)); 
     48        $this->assertEqual($query->getSqlQueryPart('from'), array('(SELECT p.* FROM photos p LEFT JOIN photos_tags t ON t.photo_id = p.id WHERE t.tag_id = 65) p LEFT JOIN photos_tags t ON t.photo_id = p.id')); 
     49        $this->assertEqual($query->getSqlQueryPart('where'), array('p.can_see = -1 AND t.tag_id = 62')); 
     50        $this->assertEqual($query->getSqlQueryPart('limit'), array(200)); 
    5151    } 
    5252    public function testAsteriskOperator()  
  • branches/1.0/tests/Ticket/832TestCase.php

    r4354 r4681  
    8888    public function setUp() 
    8989    { 
    90         $this->loadTemplate('Ticket_832_UserTemplate'); 
     90        $this->actAs('Ticket_832_UserTemplate'); 
    9191    } 
    9292} 
     
    9696    public function setUp() 
    9797    { 
    98         $this->loadTemplate('Ticket_832_EmailTemplate'); 
     98        $this->actAs('Ticket_832_EmailTemplate'); 
    9999    } 
    100100}