/** * Returns the package for the [base] object classes. * * @return string */ public function getPackage() { return parent::getPackage() . '.Base'; }
/** * Adds the addInitialize() method to the table map class. * @param string &$script The script will be modified in this method. */ protected function addInitialize(&$script) { $table = $this->getTable(); $platform = $this->getPlatform(); $script .= "\n /**\n * Initialize the table attributes and columns\n * Relations are not initialized by this method since they are lazy loaded\n *\n * @return void\n * @throws PropelException\n */\n public function initialize()\n {\n // attributes\n \$this->setName('" . $table->getName() . "');\n \$this->setPhpName('" . $table->getPhpName() . "');\n \$this->setClassName('" . addslashes($this->getStubObjectBuilder()->getFullyQualifiedClassName()) . "');\n \$this->setPackage('" . parent::getPackage() . "');"; if ($table->getIdMethod() == "native") { $script .= "\n \$this->setUseIdGenerator(true);"; } else { $script .= "\n \$this->setUseIdGenerator(false);"; } if ($table->getIdMethodParameters()) { $params = $table->getIdMethodParameters(); $imp = $params[0]; $script .= "\n \$this->setPrimaryKeyMethodInfo('" . $imp->getValue() . "');"; } elseif ($table->getIdMethod() == IdMethod::NATIVE && ($platform->getNativeIdMethod() == PlatformInterface::SEQUENCE || $platform->getNativeIdMethod() == PlatformInterface::SERIAL)) { $script .= "\n \$this->setPrimaryKeyMethodInfo('" . $platform->getSequenceName($table) . "');"; } if ($this->getTable()->getChildrenColumn()) { $script .= "\n \$this->setSingleTableInheritance(true);"; } if ($this->getTable()->getIsCrossRef()) { $script .= "\n \$this->setIsCrossRef(true);"; } // Add columns to map $script .= "\n // columns"; foreach ($table->getColumns() as $col) { $cup = strtoupper($col->getName()); $cfc = $col->getPhpName(); if (!$col->getSize()) { $size = "null"; } else { $size = $col->getSize(); } $default = $col->getDefaultValueString(); if ($col->isPrimaryKey()) { if ($col->isForeignKey()) { foreach ($col->getForeignKeys() as $fk) { $script .= "\n \$this->addForeignPrimaryKey('{$cup}', '{$cfc}', '" . $col->getType() . "' , '" . $fk->getForeignTableName() . "', '" . strtoupper($fk->getMappedForeignColumn($col->getName())) . "', " . ($col->isNotNull() ? 'true' : 'false') . ", " . $size . ", {$default});"; } } else { $script .= "\n \$this->addPrimaryKey('{$cup}', '{$cfc}', '" . $col->getType() . "', " . var_export($col->isNotNull(), true) . ", " . $size . ", {$default});"; } } else { if ($col->isForeignKey()) { foreach ($col->getForeignKeys() as $fk) { $script .= "\n \$this->addForeignKey('{$cup}', '{$cfc}', '" . $col->getType() . "', '" . $fk->getForeignTableName() . "', '" . strtoupper($fk->getMappedForeignColumn($col->getName())) . "', " . ($col->isNotNull() ? 'true' : 'false') . ", " . $size . ", {$default});"; } } else { $script .= "\n \$this->addColumn('{$cup}', '{$cfc}', '" . $col->getType() . "', " . var_export($col->isNotNull(), true) . ", " . $size . ", {$default});"; } } // if col-is prim key if ($col->isEnumType()) { $script .= "\n \$this->getColumn('{$cup}', false)->setValueSet(" . var_export($col->getValueSet(), true) . ");"; } if ($col->isPrimaryString()) { $script .= "\n \$this->getColumn('{$cup}', false)->setPrimaryString(true);"; } } // foreach $script .= "\n } // initialize()\n"; }
public function getPackage() { return parent::getPackage(); }
/** * Gets the package for the [base] object classes. * @return string */ public function getPackage() { return $this->getChild()->getPackage() ? $this->getChild()->getPackage() : parent::getPackage(); }
/** * Gets the package for the [base] object classes. * * @return string */ public function getPackage() { return ($this->getChild()->getPackage() ? $this->getChild()->getPackage() : parent::getPackage()) . '.Base'; }