PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/sfPropel15Plugin/lib/vendor/propel-generator/lib/builder/om/PHP5ExtensionNodeBuilder.php

https://github.com/ArnaudD/global-menu
PHP | 111 lines | 34 code | 13 blank | 64 comment | 0 complexity | 46f189703eddd55a507d4b38c0279d85 MD5 | raw file
  1. <?php
  2. /**
  3. * This file is part of the Propel package.
  4. * For the full copyright and license information, please view the LICENSE
  5. * file that was distributed with this source code.
  6. *
  7. * @license MIT License
  8. */
  9. require_once 'builder/om/ObjectBuilder.php';
  10. /**
  11. * Generates the empty PHP5 stub node object class for user object model (OM).
  12. *
  13. * This class produces the empty stub class that can be customized with application
  14. * business logic, custom behavior, etc.
  15. *
  16. * This class replaces the ExtensionNode.tpl, with the intent of being easier for users
  17. * to customize (through extending & overriding).
  18. *
  19. * @author Hans Lellelid <hans@xmpl.org>
  20. * @package propel.generator.builder.om
  21. */
  22. class PHP5ExtensionNodeBuilder extends ObjectBuilder
  23. {
  24. /**
  25. * Returns the name of the current class being built.
  26. * @return string
  27. */
  28. public function getUnprefixedClassname()
  29. {
  30. return $this->getTable()->getPhpName() . 'Node';
  31. }
  32. /**
  33. * Adds the include() statements for files that this class depends on or utilizes.
  34. * @param string &$script The script will be modified in this method.
  35. */
  36. protected function addIncludes(&$script)
  37. {
  38. $script .= "
  39. require '".$this->getNodeBuilder()->getClassFilePath()."';
  40. ";
  41. } // addIncludes()
  42. /**
  43. * Adds class phpdoc comment and openning of class.
  44. * @param string &$script The script will be modified in this method.
  45. */
  46. protected function addClassOpen(&$script)
  47. {
  48. $table = $this->getTable();
  49. $tableName = $table->getName();
  50. $tableDesc = $table->getDescription();
  51. $baseClassname = $this->getNodeBuilder()->getClassname();
  52. $script .= "
  53. /**
  54. * Skeleton subclass for representing a node from the '$tableName' table.
  55. *
  56. * $tableDesc
  57. *";
  58. if ($this->getBuildProperty('addTimeStamp')) {
  59. $now = strftime('%c');
  60. $script .= "
  61. * This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:
  62. *
  63. * $now
  64. *";
  65. }
  66. $script .= "
  67. * You should add additional methods to this class to meet the
  68. * application requirements. This class will only be generated as
  69. * long as it does not already exist in the output directory.
  70. *
  71. * @package propel.generator.".$this->getPackage()."
  72. */
  73. class ".$this->getClassname()." extends $baseClassname {
  74. ";
  75. }
  76. /**
  77. * Specifies the methods that are added as part of the stub object class.
  78. *
  79. * By default there are no methods for the empty stub classes; override this method
  80. * if you want to change that behavior.
  81. *
  82. * @see ObjectBuilder::addClassBody()
  83. */
  84. protected function addClassBody(&$script)
  85. {
  86. // there is no class body
  87. }
  88. /**
  89. * Closes class.
  90. * @param string &$script The script will be modified in this method.
  91. */
  92. protected function addClassClose(&$script)
  93. {
  94. $script .= "
  95. } // " . $this->getClassname() . "
  96. ";
  97. }
  98. } // PHP5ExtensionObjectBuilder