diff --git a/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicObjectBuilder.php b/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicObjectBuilder.php index dbc9a628a..7a656ac87 100755 --- a/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicObjectBuilder.php +++ b/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicObjectBuilder.php @@ -626,10 +626,10 @@ abstract class ".$this->getClassname()." extends ".ClassTools::classname($this-> } $this->addMutatorOpen($script, $col); - + // Perform some smart checking here to handle possible type discrepancies - // between the passed-in value and the value from the DB - + // between the passed-in value and the value from the DB + if ($col->getPhpNative() === "int") { $script .= " // Since the native PHP type for this column is integer, @@ -647,7 +647,7 @@ abstract class ".$this->getClassname()." extends ".ClassTools::classname($this-> } "; } - + $script .= " if (\$this->$clo !== \$v"; if ($defaultValue !== null) { @@ -1042,7 +1042,7 @@ $script .= " * @return int The number of rows affected by this insert/update operation * @throws PropelException */ - public function save(\$con = null) + public function save(\$con=null) { \$affectedRows = 0; // initialize var to track total num of affected rows diff --git a/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php b/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php index fbf140dd8..3bc1bd402 100755 --- a/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php +++ b/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5BasicPeerBuilder.php @@ -115,8 +115,7 @@ abstract class ".$this->getClassname()." */ protected function addClassClose(&$script) { - $script .= " -} + $script .= "} "; $this->addStaticMapBuilderRegistration($script); @@ -407,14 +406,14 @@ if (Propel::isInit()) { /** A key representing a particular subclass */ const CLASSKEY_".strtoupper($child->getKey())." = '" . $child->getKey() . "'; "; - + if (strtoupper($child->getClassname()) != strtoupper($child->getKey())) { $script .= " /** A key representing a particular subclass */ const CLASSKEY_".strtoupper($child->getClassname())." = '" . $child->getKey() . "'; "; } - + $script .= " /** A class that can be returned by this peer. */ const CLASSNAME_".strtoupper($child->getKey())." = '". $childBuilder->getClasspath() . "'; @@ -985,7 +984,7 @@ if (Propel::isInit()) { * @param mixed \$values Criteria or ".$table->getPhpName()." object or primary key or array of primary keys * which is used to create the DELETE statement * @param Connection \$con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). + * @return int The number of affected rows (if supported by underlying database driver). * This includes CASCADE-related rows * if supported by native driver or if emulated using Propel. * @throws PropelException Any exceptions caught during processing will be @@ -1428,7 +1427,7 @@ if (Propel::isInit()) { $script .= "* @param $cptype $".$clo." "; } - $script .= " * @param Connection \$con + $script .= " * @param Connection \$con * @return ".$table->getPhpName()." */ public static function ".$this->getRetrieveMethodName()."("; @@ -1452,7 +1451,8 @@ if (Propel::isInit()) { \$v = ".$this->getPeerClassname()."::doSelect(\$criteria, \$con); return !empty(\$v) ? \$v[0] : null; - }"; + } +"; } /** diff --git a/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5MapBuilderBuilder.php b/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5MapBuilderBuilder.php index 3fc6ba928..56c431a34 100755 --- a/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5MapBuilderBuilder.php +++ b/gulliver/thirdparty/propel-generator/classes/propel/engine/builder/om/php5/PHP5MapBuilderBuilder.php @@ -33,60 +33,60 @@ require_once 'propel/engine/builder/om/OMBuilder.php'; */ class PHP5MapBuilderBuilder extends OMBuilder { - /** - * Gets the package for the map builder classes. - * @return string - */ - public function getPackage() - { - return parent::getPackage() . '.map'; - } + /** + * Gets the package for the map builder classes. + * @return string + */ + public function getPackage() + { + return parent::getPackage() . '.map'; + } - /** - * Returns the name of the current class being built. - * @return string - */ - public function getClassname() - { - return $this->getTable()->getPhpName() . 'MapBuilder'; - } + /** + * Returns the name of the current class being built. + * @return string + */ + public function getClassname() + { + return $this->getTable()->getPhpName() . 'MapBuilder'; + } - /** - * Adds the include() statements for files that this class depends on or utilizes. - * @param string &$script The script will be modified in this method. - */ - protected function addIncludes(&$script) - { - $script .= " + /** + * Adds the include() statements for files that this class depends on or utilizes. + * @param string &$script The script will be modified in this method. + */ + protected function addIncludes(&$script) + { + $script .= " require_once 'propel/map/MapBuilder.php'; include_once 'creole/CreoleTypes.php'; "; - } // addIncludes() + } // addIncludes() - /** - * 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(); - $script .= " + /** + * 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(); + $script .= " /** * This class adds structure of '".$table->getName()."' table to '".$table->getDatabase()->getName()."' DatabaseMap object. * *"; - if ($this->getBuildProperty('addTimeStamp')) { - $now = strftime('%c'); - $script .= " + if ($this->getBuildProperty('addTimeStamp')) { + $now = strftime('%c'); + $script .= " * This class was autogenerated by Propel on: * * $now *"; - } - $script .= " + } + $script .= " * * These statically-built map classes are used by Propel to do runtime db structure discovery. * For example, the createSelectSql() method checks the type of a given column used in an @@ -95,206 +95,207 @@ include_once 'creole/CreoleTypes.php'; * * @package workflow.".$this->getPackage()." */ -class ".$this->getClassname()." { +class ".$this->getClassname()." +{ "; - } + } - /** - * Specifies the methods that are added as part of the map builder class. - * This can be overridden by subclasses that wish to add more methods. - * @see ObjectBuilder::addClassBody() - */ - protected function addClassBody(&$script) - { - $this->addConstants($script); - $this->addAttributes($script); + /** + * Specifies the methods that are added as part of the map builder class. + * This can be overridden by subclasses that wish to add more methods. + * @see ObjectBuilder::addClassBody() + */ + protected function addClassBody(&$script) + { + $this->addConstants($script); + $this->addAttributes($script); - $this->addIsBuilt($script); - $this->addGetDatabaseMap($script); - $this->addDoBuild($script); - } + $this->addIsBuilt($script); + $this->addGetDatabaseMap($script); + $this->addDoBuild($script); + } - /** - * Adds any constants needed for this MapBuilder class. - * @param string &$script The script will be modified in this method. - */ - protected function addConstants(&$script) - { - $script .= " - /** - * The (dot-path) name of this class - */ - const CLASS_NAME = '".$this->getClasspath()."'; + /** + * Adds any constants needed for this MapBuilder class. + * @param string &$script The script will be modified in this method. + */ + protected function addConstants(&$script) + { + $script .= " + /** + * The (dot-path) name of this class + */ + const CLASS_NAME = '".$this->getClasspath()."'; "; - } + } - /** - * Adds any attributes needed for this MapBuilder class. - * @param string &$script The script will be modified in this method. - */ - protected function addAttributes(&$script) - { - $script .= " - /** - * The database map. - */ - private \$dbMap; + /** + * Adds any attributes needed for this MapBuilder class. + * @param string &$script The script will be modified in this method. + */ + protected function addAttributes(&$script) + { + $script .= " + /** + * The database map. + */ + private \$dbMap; "; - } + } - /** - * Closes class. - * @param string &$script The script will be modified in this method. - */ - protected function addClassClose(&$script) - { - $script .= " + /** + * Closes class. + * @param string &$script The script will be modified in this method. + */ + protected function addClassClose(&$script) + { + $script .= " } // " . $this->getClassname() . " "; - } + } - /** - * Adds the method that indicates whether this map has already been built. - * @param string &$script The script will be modified in this method. - */ - protected function addIsBuilt(&$script) - { - $script .= " - /** - * Tells us if this DatabaseMapBuilder is built so that we - * don't have to re-build it every time. - * - * @return boolean true if this DatabaseMapBuilder is built, false otherwise. - */ - public function isBuilt() - { - return (\$this->dbMap !== null); - } + /** + * Adds the method that indicates whether this map has already been built. + * @param string &$script The script will be modified in this method. + */ + protected function addIsBuilt(&$script) + { + $script .= " + /** + * Tells us if this DatabaseMapBuilder is built so that we + * don't have to re-build it every time. + * + * @return boolean true if this DatabaseMapBuilder is built, false otherwise. + */ + public function isBuilt() + { + return (\$this->dbMap !== null); + } "; - } + } - /** - * Adds the DatabaseMap accessor method. - * @param string &$script The script will be modified in this method. - */ - protected function addGetDatabaseMap(&$script) - { - $script .= " - /** - * Gets the databasemap this map builder built. - * - * @return the databasemap - */ - public function getDatabaseMap() - { - return \$this->dbMap; - } + /** + * Adds the DatabaseMap accessor method. + * @param string &$script The script will be modified in this method. + */ + protected function addGetDatabaseMap(&$script) + { + $script .= " + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return \$this->dbMap; + } "; - } + } - /** - * Adds the main doBuild() method to the map builder class. - * @param string &$script The script will be modified in this method. - */ - protected function addDoBuild(&$script) - { + /** + * Adds the main doBuild() method to the map builder class. + * @param string &$script The script will be modified in this method. + */ + protected function addDoBuild(&$script) + { - $table = $this->getTable(); - $platform = $this->getPlatform(); + $table = $this->getTable(); + $platform = $this->getPlatform(); - $script .= " - /** - * The doBuild() method builds the DatabaseMap - * - * @return void - * @throws PropelException - */ - public function doBuild() - { - \$this->dbMap = Propel::getDatabaseMap('".$table->getDatabase()->getName()."'); + $script .= " + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + \$this->dbMap = Propel::getDatabaseMap('".$table->getDatabase()->getName()."'); - \$tMap = \$this->dbMap->addTable('".$table->getName()."'); - \$tMap->setPhpName('".$table->getPhpName()."'); + \$tMap = \$this->dbMap->addTable('".$table->getName()."'); + \$tMap->setPhpName('".$table->getPhpName()."'); "; - if ($table->getIdMethod() == "native") { - $script .= " - \$tMap->setUseIdGenerator(true); + if ($table->getIdMethod() == "native") { + $script .= " + \$tMap->setUseIdGenerator(true); "; - } else { - $script .= " - \$tMap->setUseIdGenerator(false); + } else { + $script .= " + \$tMap->setUseIdGenerator(false); "; - } + } - if ($table->getIdMethodParameters()) { - $params = $table->getIdMethodParameters(); - $imp = $params[0]; - $script .= " - \$tMap->setPrimaryKeyMethodInfo('".$imp->getValue()."'); + if ($table->getIdMethodParameters()) { + $params = $table->getIdMethodParameters(); + $imp = $params[0]; + $script .= " + \$tMap->setPrimaryKeyMethodInfo('".$imp->getValue()."'); "; - } elseif ($table->getIdMethod() == "native" && ($platform->getNativeIdMethod() == Platform::SEQUENCE)) { - $script .= " - \$tMap->setPrimaryKeyMethodInfo('".$table->getSequenceName()."'); + } elseif ($table->getIdMethod() == "native" && ($platform->getNativeIdMethod() == Platform::SEQUENCE)) { + $script .= " + \$tMap->setPrimaryKeyMethodInfo('".$table->getSequenceName()."'); "; - } elseif ($table->getIdMethod() == "native" && ($platform->getNativeIdMethod() == Platform::SEQUENCE)) { - $script .= " - \$tMap->setPrimaryKeyMethodInfo('".$table->getName()."'); + } elseif ($table->getIdMethod() == "native" && ($platform->getNativeIdMethod() == Platform::SEQUENCE)) { + $script .= " + \$tMap->setPrimaryKeyMethodInfo('".$table->getName()."'); "; - } + } - // Add columns to map - foreach ($table->getColumns() as $col) { - $tfc=$table->getPhpName(); - $cfc=$col->getPhpName(); - $cup=strtoupper($col->getName()); - if (!$col->getSize()) { - $size = "null"; - } else { - $size = $col->getSize(); - } - if($col->isPrimaryKey()) { - if($col->isForeignKey()) { - $script .= " - \$tMap->addForeignPrimaryKey('$cup', '$cfc', '".$col->getPhpType()."' , CreoleTypes::".$col->getType().", '".$col->getRelatedTableName()."', '".strtoupper($col->getRelatedColumnName())."', ".($col->isNotNull() ? 'true' : 'false').", ".$size."); + // Add columns to map + foreach ($table->getColumns() as $col) { + $tfc=$table->getPhpName(); + $cfc=$col->getPhpName(); + $cup=strtoupper($col->getName()); + if (!$col->getSize()) { + $size = "null"; + } else { + $size = $col->getSize(); + } + if($col->isPrimaryKey()) { + if($col->isForeignKey()) { + $script .= " + \$tMap->addForeignPrimaryKey('$cup', '$cfc', '".$col->getPhpType()."' , CreoleTypes::".$col->getType().", '".$col->getRelatedTableName()."', '".strtoupper($col->getRelatedColumnName())."', ".($col->isNotNull() ? 'true' : 'false').", ".$size."); "; - } else { - $script .= " - \$tMap->addPrimaryKey('$cup', '$cfc', '".$col->getPhpType()."', CreoleTypes::".$col->getType().", ".var_export($col->isNotNull(), true).", ".$size."); + } else { + $script .= " + \$tMap->addPrimaryKey('$cup', '$cfc', '".$col->getPhpType()."', CreoleTypes::".$col->getType().", ".var_export($col->isNotNull(), true).", ".$size."); "; - } - } else { - if($col->isForeignKey()) { - $script .= " - \$tMap->addForeignKey('$cup', '$cfc', '".$col->getPhpType()."', CreoleTypes::".$col->getType().", '".$col->getRelatedTableName()."', '".strtoupper($col->getRelatedColumnName())."', ".($col->isNotNull() ? 'true' : 'false').", ".$size."); + } + } else { + if($col->isForeignKey()) { + $script .= " + \$tMap->addForeignKey('$cup', '$cfc', '".$col->getPhpType()."', CreoleTypes::".$col->getType().", '".$col->getRelatedTableName()."', '".strtoupper($col->getRelatedColumnName())."', ".($col->isNotNull() ? 'true' : 'false').", ".$size."); "; - } else { - $script .= " - \$tMap->addColumn('$cup', '$cfc', '".$col->getPhpType()."', CreoleTypes::".$col->getType().", ".var_export($col->isNotNull(), true).", ".$size."); + } else { + $script .= " + \$tMap->addColumn('$cup', '$cfc', '".$col->getPhpType()."', CreoleTypes::".$col->getType().", ".var_export($col->isNotNull(), true).", ".$size."); "; - } - } // if col-is prim key - } // foreach + } + } // if col-is prim key + } // foreach - foreach($table->getValidators() as $val) { - $col = $val->getColumn(); - $cup = strtoupper($col->getName()); - foreach($val->getRules() as $rule) { - if ($val->getTranslate() !== Validator::TRANSLATE_NONE) { - $script .= " - \$tMap->addValidator('$cup', '".$rule->getName()."', '".$rule->getClass()."', '".$rule->getValue()."', ".$val->getTranslate()."('".str_replace("'", "\'", $rule->getMessage())."')); + foreach($table->getValidators() as $val) { + $col = $val->getColumn(); + $cup = strtoupper($col->getName()); + foreach($val->getRules() as $rule) { + if ($val->getTranslate() !== Validator::TRANSLATE_NONE) { + $script .= " + \$tMap->addValidator('$cup', '".$rule->getName()."', '".$rule->getClass()."', '".$rule->getValue()."', ".$val->getTranslate()."('".str_replace("'", "\'", $rule->getMessage())."')); "; - } else { - $script .= " - \$tMap->addValidator('$cup', '".$rule->getName()."', '".$rule->getClass()."', '".$rule->getValue()."', '".str_replace("'", "\'", $rule->getMessage())."'); + } else { + $script .= " + \$tMap->addValidator('$cup', '".$rule->getName()."', '".$rule->getClass()."', '".$rule->getValue()."', '".str_replace("'", "\'", $rule->getMessage())."'); "; - } // if ($rule->getTranslation() ... - } // foreach rule - } // foreach validator + } // if ($rule->getTranslation() ... + } // foreach rule + } // foreach validator - $script .= " - } // doBuild() + $script .= " + } // doBuild() "; - } + } } // PHP5ExtensionPeerBuilder