Changeset 4340
- Timestamp:
- 05/07/08 01:14:06 (14 months ago)
- Files:
-
- 1 modified
-
branches/0.11/lib/Doctrine/Import/Builder.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Import/Builder.php
r4335 r4340 346 346 } 347 347 348 self::$_tpl =<<<END 349 /** 350 * This class has been auto-generated by the Doctrine ORM Framework 351 */ 352 %sclass %s extends %s 353 { 354 %s 355 %s 356 %s 357 } 358 END; 348 self::$_tpl = '/**' . PHP_EOL 349 . ' * This class has been auto-generated by the Doctrine ORM Framework' . PHP_EOL 350 . ' */' . PHP_EOL 351 . '%sclass %s extends %s' . PHP_EOL 352 . '{' . PHP_EOL 353 . '%s' . PHP_EOL 354 . '%s' . PHP_EOL 355 . '%s' . PHP_EOL 356 . '}' . PHP_EOL; 359 357 } 360 358 … … 410 408 } 411 409 412 $code = implode( "\n", $ret);410 $code = implode(PHP_EOL, $ret); 413 411 $code = trim($code); 414 412 415 return "\n public function setTableDefinition()"."\n {\n ".$code."\n }";413 return PHP_EOL . " public function setTableDefinition()" . PHP_EOL . ' {' . PHP_EOL . ' ' . $code . PHP_EOL . ' }'; 416 414 } 417 415 … … 488 486 } 489 487 490 $ret[$i] .= ');'. "\n";488 $ret[$i] .= ');'.PHP_EOL; 491 489 $i++; 492 490 } … … 503 501 } 504 502 505 $code = implode( "\n", $ret);503 $code = implode(PHP_EOL, $ret); 506 504 $code = trim($code); 507 505 508 return "\n public function setUp()\n {\n ".$code."\n }";506 return PHP_EOL . ' public function setUp()' . PHP_EOL . ' {' . PHP_EOL . ' ' . $code . PHP_EOL . ' }'; 509 507 } 510 508 … … 544 542 } 545 543 546 $build .= ");\n";544 $build .= ');' . PHP_EOL; 547 545 } 548 546 … … 591 589 foreach ($accessors as $name) { 592 590 // getters 593 $ret .= "\n public function get" . Doctrine_Inflector::classify(Doctrine_Inflector::tableize($name)) . "(\$load = true)\n";594 $ret .= " { \n";595 $ret .= " return \$this->get('{$name}', \$load); \n";596 $ret .= " } \n";591 $ret .= PHP_EOL . ' public function get' . Doctrine_Inflector::classify(Doctrine_Inflector::tableize($name)) . "(\$load = true)" . PHP_EOL; 592 $ret .= " {" . PHP_EOL; 593 $ret .= " return \$this->get('{$name}', \$load);" . PHP_EOL; 594 $ret .= " }" . PHP_EOL; 597 595 598 596 // setters 599 $ret .= "\n public function set" . Doctrine_Inflector::classify(Doctrine_Inflector::tableize($name)) . "(\${$name}, \$load = true)\n";600 $ret .= " {\n";601 $ret .= " return \$this->set('{$name}', \${$name}, \$load); \n";602 $ret .= " } \n";597 $ret .= PHP_EOL . ' public function set' . Doctrine_Inflector::classify(Doctrine_Inflector::tableize($name)) . "(\${$name}, \$load = true)" . PHP_EOL; 598 $ret .= " {" . PHP_EOL; 599 $ret .= " return \$this->set('{$name}', \${$name}, \$load);" . PHP_EOL; 600 $ret .= " }" . PHP_EOL; 603 601 } 604 602 … … 620 618 $optionsPhp = $this->varExport($options); 621 619 622 $build .= " \$this->loadTemplate('" . $name . "', " . $optionsPhp . "); \n";620 $build .= " \$this->loadTemplate('" . $name . "', " . $optionsPhp . ");" . PHP_EOL; 623 621 } else { 624 622 if (isset($templates[0])) { 625 $build .= " \$this->loadTemplate('" . $options . "'); \n";623 $build .= " \$this->loadTemplate('" . $options . "');" . PHP_EOL; 626 624 } else { 627 $build .= " \$this->loadTemplate('" . $name . "'); \n";625 $build .= " \$this->loadTemplate('" . $name . "');" . PHP_EOL; 628 626 } 629 627 } … … 646 644 $optionsPhp = $this->varExport($options); 647 645 648 $build .= " \$this->actAs('" . $name . "', " . $optionsPhp . "); \n";646 $build .= " \$this->actAs('" . $name . "', " . $optionsPhp . ");" . PHP_EOL; 649 647 } else { 650 648 if (isset($actAs[0])) { 651 $build .= " \$this->actAs('" . $options . "'); \n";649 $build .= " \$this->actAs('" . $options . "');" . PHP_EOL; 652 650 } else { 653 $build .= " \$this->actAs('" . $name . "'); \n";651 $build .= " \$this->actAs('" . $name . "');" . PHP_EOL; 654 652 } 655 653 } … … 667 665 public function buildAttributes(array $attributes) 668 666 { 669 $build = "\n";667 $build = PHP_EOL; 670 668 foreach ($attributes as $key => $value) { 671 669 … … 687 685 } 688 686 689 $build .= " \$this->setAttribute(Doctrine::ATTR_" . strtoupper($key) . ", " . $values . "); \n";687 $build .= " \$this->setAttribute(Doctrine::ATTR_" . strtoupper($key) . ", " . $values . ");" . PHP_EOL; 690 688 } 691 689 … … 703 701 $build = ''; 704 702 foreach ($options as $name => $value) { 705 $build .= " \$this->option('$name', " . $this->varExport($value) . "); \n";703 $build .= " \$this->option('$name', " . $this->varExport($value) . ");" . PHP_EOL; 706 704 } 707 705 … … 720 718 721 719 foreach ($indexes as $indexName => $definitions) { 722 $build .= "\n\$this->index('" . $indexName . "'";720 $build .= PHP_EOL . " \$this->index('" . $indexName . "'"; 723 721 $build .= ', ' . $this->varExport($definitions); 724 722 $build .= ');'; … … 946 944 947 945 if (isset($definition['connection']) && $definition['connection']) { 948 $code .= "// Connection Component Binding \n";949 $code .= "Doctrine_Manager::getInstance()->bindComponent('" . $definition['connectionClassName'] . "', '" . $definition['connection'] . "'); \n";946 $code .= "// Connection Component Binding" . PHP_EOL; 947 $code .= "Doctrine_Manager::getInstance()->bindComponent('" . $definition['connectionClassName'] . "', '" . $definition['connection'] . "');" . PHP_EOL; 950 948 } 951 949