Changeset 4681
- Timestamp:
- 07/13/08 01:04:42 (5 months ago)
- Location:
- branches/1.0
- Files:
-
- 15 modified
-
docs/manual/de/class-templates.txt (modified) (5 diffs)
-
docs/manual/de/hierarchical-data/nested-set.txt (modified) (1 diff)
-
docs/manual/en/behaviors.txt (modified) (5 diffs)
-
docs/manual/en/hierarchical-data/nested-set.txt (modified) (1 diff)
-
docs/manual/ja/class-templates.txt (modified) (5 diffs)
-
docs/manual/ja/hierarchical-data.txt (modified) (1 diff)
-
lib/Doctrine/Import/Builder.php (modified) (2 diffs)
-
lib/Doctrine/Record/Abstract.php (modified) (1 diff)
-
tests/models/Blog.php (modified) (1 diff)
-
tests/models/ConcreteEmail.php (modified) (1 diff)
-
tests/models/ConcreteGroup.php (modified) (1 diff)
-
tests/models/ConcreteGroupUser.php (modified) (1 diff)
-
tests/models/ConcreteUser.php (modified) (1 diff)
-
tests/RawSqlTestCase.php (modified) (2 diffs)
-
tests/Ticket/832TestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/docs/manual/de/class-templates.txt
r4674 r4681 44 44 </code> 45 45 46 Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add loadTemplate()46 Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add actAs() 47 47 call in the class definition. 48 48 … … 57 57 public function setUp() 58 58 { 59 $this-> loadTemplate('TimestampTemplate');59 $this->actAs('TimestampTemplate'); 60 60 } 61 61 } … … 140 140 public function setUp() 141 141 { 142 $this-> loadTemplate('UserTemplate');142 $this->actAs('UserTemplate'); 143 143 } 144 144 } … … 147 147 public function setUp() 148 148 { 149 $this-> loadTemplate('EmailTemplate');149 $this->actAs('EmailTemplate'); 150 150 } 151 151 } … … 191 191 public function setUp() 192 192 { 193 $this-> loadTemplate('AuthTemplate');193 $this->actAs('AuthTemplate'); 194 194 } 195 195 } -
branches/1.0/docs/manual/de/hierarchical-data/nested-set.txt
r4674 r4681 37 37 ... 38 38 39 $this-> loadTemplate('Doctrine_Template_NestedSet');39 $this->actAs('Doctrine_Template_NestedSet'); 40 40 41 41 ... -
branches/1.0/docs/manual/en/behaviors.txt
r4678 r4681 618 618 </code> 619 619 620 Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add loadTemplate()620 Lets say we have a class called Blog that needs the timestamp functionality. All we need to do is to add actAs() 621 621 call in the class definition. 622 622 … … 631 631 public function setUp() 632 632 { 633 $this-> loadTemplate('TimestampTemplate');633 $this->actAs('TimestampTemplate'); 634 634 } 635 635 } … … 714 714 public function setUp() 715 715 { 716 $this-> loadTemplate('UserTemplate');716 $this->actAs('UserTemplate'); 717 717 } 718 718 } … … 721 721 public function setUp() 722 722 { 723 $this-> loadTemplate('EmailTemplate');723 $this->actAs('EmailTemplate'); 724 724 } 725 725 } … … 765 765 public function setUp() 766 766 { 767 $this-> loadTemplate('AuthTemplate');767 $this->actAs('AuthTemplate'); 768 768 } 769 769 } -
branches/1.0/docs/manual/en/hierarchical-data/nested-set.txt
r4674 r4681 37 37 ... 38 38 39 $this-> loadTemplate('Doctrine_Template_NestedSet');39 $this->actAs('Doctrine_Template_NestedSet'); 40 40 41 41 ... -
branches/1.0/docs/manual/ja/class-templates.txt
r4674 r4681 43 43 ã¿ã€ã ã¹ã¿ã³ãã®æ©èœãå¿ 44 44 èŠãšããBlogãšåŒã°ããã¯ã©ã¹ãèããŠã¿ãŸããããå¿ 45 èŠãªããšã¯ loadTemplate()ã³ãŒã«ãã¯ã©ã¹å®çŸ©ã«è¿œå ããããšã§ãã45 èŠãªããšã¯actAs()ã³ãŒã«ãã¯ã©ã¹å®çŸ©ã«è¿œå ããããšã§ãã 46 46 47 47 <code type="php"> … … 55 55 public function setUp() 56 56 { 57 $this-> loadTemplate('TimestampTemplate');57 $this->actAs('TimestampTemplate'); 58 58 } 59 59 } … … 137 137 public function setUp() 138 138 { 139 $this-> loadTemplate('UserTemplate');139 $this->actAs('UserTemplate'); 140 140 } 141 141 } … … 144 144 public function setUp() 145 145 { 146 $this-> loadTemplate('EmailTemplate');146 $this->actAs('EmailTemplate'); 147 147 } 148 148 } … … 192 192 public function setUp() 193 193 { 194 $this-> loadTemplate('AuthTemplate');194 $this->actAs('AuthTemplate'); 195 195 } 196 196 } -
branches/1.0/docs/manual/ja/hierarchical-data.txt
r4674 r4681 70 70 ... 71 71 72 $this-> loadTemplate('Doctrine_Template_NestedSet');72 $this->actAs('Doctrine_Template_NestedSet'); 73 73 74 74 ... -
branches/1.0/lib/Doctrine/Import/Builder.php
r4679 r4681 487 487 } 488 488 489 if (isset($definition['templates']) && is_array($definition['templates']) && !empty($definition['templates'])) {490 $ret[$i] = $this->buildTemplates($definition['templates']);491 $i++;492 }493 494 489 if (isset($definition['actAs']) && is_array($definition['actAs']) && !empty($definition['actAs'])) { 495 490 $ret[$i] = $this->buildActAs($definition['actAs']); … … 620 615 621 616 return $ret; 622 }623 624 /**625 * buildTemplates626 *627 * @param string $array628 * @return void629 */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;649 617 } 650 618 -
branches/1.0/lib/Doctrine/Record/Abstract.php
r4460 r4681 269 269 $this->hasColumn($name, $options['type'], $options['length'], $options); 270 270 } 271 }272 /**273 * loadTemplate274 *275 * @param string $template276 */277 public function loadTemplate($template, array $options = array())278 {279 $this->actAs($template, $options);280 271 } 281 272 -
branches/1.0/tests/models/Blog.php
r2588 r4681 8 8 public function setUp() 9 9 { 10 $this-> loadTemplate('Taggable');10 $this->actAs('Taggable'); 11 11 } 12 12 } -
branches/1.0/tests/models/ConcreteEmail.php
r2353 r4681 4 4 public function setUp() 5 5 { 6 $this-> loadTemplate('EmailTemplate');6 $this->actAs('EmailTemplate'); 7 7 } 8 8 } -
branches/1.0/tests/models/ConcreteGroup.php
r2353 r4681 4 4 public function setUp() 5 5 { 6 $this-> loadTemplate('GroupTemplate');6 $this->actAs('GroupTemplate'); 7 7 } 8 8 } -
branches/1.0/tests/models/ConcreteGroupUser.php
r2353 r4681 4 4 public function setUp() 5 5 { 6 $this-> loadTemplate('GroupUserTemplate');6 $this->actAs('GroupUserTemplate'); 7 7 } 8 8 } -
branches/1.0/tests/models/ConcreteUser.php
r2353 r4681 4 4 public function setUp() 5 5 { 6 $this-> loadTemplate('UserTemplate');6 $this->actAs('UserTemplate'); 7 7 } 8 8 } -
branches/1.0/tests/RawSqlTestCase.php
r3884 r4681 40 40 $query->parseQuery($sql); 41 41 42 $this->assertEqual($query->get QueryPart('from'), array('photos p'));42 $this->assertEqual($query->getSqlQueryPart('from'), array('photos p')); 43 43 44 44 … … 46 46 $query->parseQuery($sql); 47 47 48 $this->assertEqual($query->get QueryPart('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->get QueryPart('where'), array('p.can_see = -1 AND t.tag_id = 62'));50 $this->assertEqual($query->get QueryPart('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)); 51 51 } 52 52 public function testAsteriskOperator() -
branches/1.0/tests/Ticket/832TestCase.php
r4354 r4681 88 88 public function setUp() 89 89 { 90 $this-> loadTemplate('Ticket_832_UserTemplate');90 $this->actAs('Ticket_832_UserTemplate'); 91 91 } 92 92 } … … 96 96 public function setUp() 97 97 { 98 $this-> loadTemplate('Ticket_832_EmailTemplate');98 $this->actAs('Ticket_832_EmailTemplate'); 99 99 } 100 100 }