[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/ -> PHP5ExtensionObjectBuilder.php (source)

   1  <?php
   2  
   3  /*
   4   *  $Id: PHP5BasicObjectBuilder.php 120 2005-06-17 02:18:41Z hans $
   5   *
   6   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   7   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   8   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   9   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  10   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  11   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  12   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  13   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  14   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  15   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  16   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17   *
  18   * This software consists of voluntary contributions made by many individuals
  19   * and is licensed under the LGPL. For more information please see
  20   * <http://propel.phpdb.org>.
  21   */
  22  
  23  require_once 'propel/engine/builder/om/ObjectBuilder.php';
  24  
  25  /**
  26   * Generates the empty PHP5 stub object class for user object model (OM).
  27   * 
  28   * This class produces the empty stub class that can be customized with application
  29   * business logic, custom behavior, etc.
  30   * 
  31   * This class replaces the ExtensionObject.tpl, with the intent of being easier for users
  32   * to customize (through extending & overriding).
  33   * 
  34   * @author Hans Lellelid <hans@xmpl.org>
  35   * @package propel.engine.builder.om.php5
  36   */
  37  class PHP5ExtensionObjectBuilder extends ObjectBuilder {        
  38      
  39      /**
  40       * Returns the name of the current class being built.
  41       * @return string
  42       */
  43  	public function getClassname()
  44      {
  45          return $this->getTable()->getPhpName();
  46      }
  47      
  48      /**
  49       * Adds the include() statements for files that this class depends on or utilizes.
  50       * @param string &$script The script will be modified in this method.
  51       */
  52  	protected function addIncludes(&$script)
  53      {
  54          $script .= "
  55  require_once '".$this->getObjectBuilder()->getClassFilePath()."';
  56  ";
  57          
  58      } // addIncludes()
  59      
  60      /**
  61       * Adds class phpdoc comment and openning of class.
  62       * @param string &$script The script will be modified in this method.
  63       */
  64  	protected function addClassOpen(&$script)
  65      {
  66          
  67          $table = $this->getTable();
  68          $tableName = $table->getName();
  69          $tableDesc = $table->getDescription();
  70          
  71          $baseClassname = $this->getObjectBuilder()->getClassname();
  72          
  73          $script .= "
  74  
  75  /**
  76   * Skeleton subclass for representing a row from the '$tableName' table.
  77   *
  78   * $tableDesc
  79   *";
  80          if ($this->getBuildProperty('addTimeStamp')) {
  81              $now = strftime('%c');
  82              $script .= "
  83   * This class was autogenerated by Propel on:
  84   *
  85   * $now
  86   *";
  87          }
  88          $script .= "
  89   * You should add additional methods to this class to meet the
  90   * application requirements.  This class will only be generated as
  91   * long as it does not already exist in the output directory.
  92   *
  93   * @package ".$this->getPackage()."
  94   */    
  95  class ".$this->getClassname()." extends $baseClassname {
  96  ";
  97      }
  98      
  99      /**
 100       * Specifies the methods that are added as part of the stub object class.
 101       * 
 102       * By default there are no methods for the empty stub classes; override this method
 103       * if you want to change that behavior.
 104       * 
 105       * @see ObjectBuilder::addClassBody()
 106       */
 107  	protected function addClassBody(&$script)
 108      {
 109          // there is no class body
 110      }
 111      
 112      /**
 113       * Closes class.
 114       * @param string &$script The script will be modified in this method.
 115       */    
 116  	protected function addClassClose(&$script)
 117      {
 118          $script .= "
 119  } // " . $this->getClassname() . "
 120  ";
 121      }
 122      
 123  } // PHP5ExtensionObjectBuilder


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7