/**
  * Returns classpath to parent class.
  * @return     string
  */
 protected function getParentClassName()
 {
     $ancestorClassName = ClassTools::classname($this->getChild()->getAncestor());
     if ($this->getDatabase()->hasTableByPhpName($ancestorClassName)) {
         return $this->getNewStubQueryBuilder($this->getDatabase()->getTableByPhpName($ancestorClassName))->getClassname();
     } else {
         // find the inheritance for the parent class
         foreach ($this->getTable()->getChildrenColumn()->getChildren() as $child) {
             if ($child->getClassName() == $ancestorClassName) {
                 return $this->getNewStubQueryInheritanceBuilder($child)->getClassname();
             }
         }
     }
 }
Пример #2
0
 /**
  * Adds class phpdoc comment and opening of class.
  *
  * @param string &$script
  */
 protected function addClassOpen(&$script)
 {
     $table = $this->getTable();
     $tableName = $table->getName();
     $tableDesc = $table->getDescription();
     if (null !== ($parentClass = $this->getBehaviorContent('parentClass')) || null !== ($parentClass = ClassTools::classname($this->getBaseClass()))) {
         $parentClass = ' extends ' . $parentClass;
     }
     if ($this->getBuildProperty('generator.objectModel.addClassLevelComment')) {
         $script .= "\n/**\n * Base class that represents a row from the '{$tableName}' table.\n *\n * {$tableDesc}\n *";
         if ($this->getBuildProperty('generator.objectModel.addTimeStamp')) {
             $now = strftime('%c');
             $script .= "\n * This class was autogenerated by Propel " . $this->getBuildProperty('general.version') . " on:\n *\n * {$now}\n *";
         }
         $script .= "\n* @package    propel.generator." . $this->getPackage() . "\n*/";
     }
     $script .= "\nabstract class " . $this->getUnqualifiedClassName() . $parentClass . " implements ActiveRecordInterface ";
     if ($interface = $this->getInterface()) {
         $script .= ", Child" . ClassTools::classname($interface);
         if ($interface !== ClassTools::classname($interface)) {
             $this->declareClass($interface);
         } else {
             $this->declareClassFromBuilder($this->getInterfaceBuilder());
         }
     }
     $script .= "\n{";
 }
 /**
  * Returns classname of parent class.
  *
  * @return string
  */
 protected function getParentClassName()
 {
     return ClassTools::classname($this->getParentClasspath());
 }
Пример #4
0
 /**
  * Adds class phpdoc comment and openning of class.
  * @param      string &$script The script will be modified in this method.
  */
 protected function addClassOpen(&$script)
 {
     $table = $this->getTable();
     $tableName = $table->getName();
     $tableDesc = $table->getDescription();
     $interface = $this->getInterface();
     $parentClass = $this->getBehaviorContent('parentClass');
     $parentClass = null !== $parentClass ? $parentClass : ClassTools::classname($this->getBaseClass());
     $script .= "\n/**\n * Base class that represents a row from the '{$tableName}' table.\n *\n * {$tableDesc}\n *";
     if ($this->getBuildProperty('addTimeStamp')) {
         $now = strftime('%c');
         $script .= "\n * This class was autogenerated by Propel " . $this->getBuildProperty('version') . " on:\n *\n * {$now}\n *";
     }
     $script .= "\n */\nabstract class " . $this->getClassname() . " extends " . $parentClass . " ";
     $interface = ClassTools::getInterface($table);
     if ($interface) {
         $script .= " implements " . ClassTools::classname($interface);
     }
     if ($this->getTable()->getInterface()) {
         $this->declareClassFromBuilder($this->getInterfaceBuilder());
     }
     $script .= "\n{\n";
 }