From 6e06bc8c6c51917359e634a8cf04e3bee45d318d Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Mon, 17 Sep 2012 19:52:11 -0400 Subject: [PATCH 1/3] CODE STYLE fixing the propel generated files for om folder --- .../om/php5/PHP5BasicObjectBuilder.php | 20 +- .../builder/om/php5/PHP5BasicPeerBuilder.php | 32 +- .../builder/om/php5/PHP5MapBuilderBuilder.php | 405 +++++++++--------- 3 files changed, 229 insertions(+), 228 deletions(-) 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..bdb8a4c72 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) { @@ -808,7 +808,7 @@ abstract class ".$this->getClassname()." extends ".ClassTools::classname($this-> * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM * @return an associative array containing the field names (as keys) and field values */ - public function toArray(\$keyType = BasePeer::TYPE_PHPNAME) + public function toArray(\$keyType=BasePeer::TYPE_PHPNAME) { \$keys = ".$this->getPeerClassname()."::getFieldNames(\$keyType); \$result = array("; @@ -835,7 +835,7 @@ abstract class ".$this->getClassname()." extends ".ClassTools::classname($this-> * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM * @return mixed Value of field. */ - public function getByName(\$name, \$type = BasePeer::TYPE_PHPNAME) + public function getByName(\$name, \$type=BasePeer::TYPE_PHPNAME) { \$pos = ".$this->getPeerClassname()."::translateFieldName(\$name, \$type, BasePeer::TYPE_NUM); return \$this->getByPosition(\$pos); @@ -890,7 +890,7 @@ $script .= " * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM * @return void */ - public function setByName(\$name, \$value, \$type = BasePeer::TYPE_PHPNAME) + public function setByName(\$name, \$value, \$type=BasePeer::TYPE_PHPNAME) { \$pos = ".$this->getPeerClassname()."::translateFieldName(\$name, \$type, BasePeer::TYPE_NUM); return \$this->setByPosition(\$pos, \$value); @@ -949,7 +949,7 @@ $script .= " * @param string \$keyType The type of keys the array uses. * @return void */ - public function fromArray(\$arr, \$keyType = BasePeer::TYPE_PHPNAME) + public function fromArray(\$arr, \$keyType=BasePeer::TYPE_PHPNAME) { \$keys = ".$this->getPeerClassname()."::getFieldNames(\$keyType); "; @@ -981,7 +981,7 @@ $script .= " * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ - public function delete(\$con = null) + public function delete(\$con=null) { if (\$this->isDeleted()) { throw new PropelException(\"This object has already been deleted.\"); @@ -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..d7d4f6963 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 @@ -297,7 +297,7 @@ if (Propel::isInit()) { * @return array A list of field names */ - static public function getFieldNames(\$type = BasePeer::TYPE_PHPNAME) + static public function getFieldNames(\$type=BasePeer::TYPE_PHPNAME) { if (!array_key_exists(\$type, self::\$fieldNames)) { throw new PropelException('Method getFieldNames() expects the parameter \$type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . \$type . ' was given.'); @@ -407,14 +407,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() . "'; @@ -528,7 +528,7 @@ if (Propel::isInit()) { * @param Connection \$con * @return int Number of matching rows. */ - public static function doCount(Criteria \$criteria, \$distinct = false, \$con = null) + public static function doCount(Criteria \$criteria, \$distinct=false, \$con=null) { // we're going to modify criteria, so copy it first \$criteria = clone \$criteria; @@ -572,7 +572,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectOne(Criteria \$criteria, \$con = null) + public static function doSelectOne(Criteria \$criteria, \$con=null) { \$critcopy = clone \$criteria; \$critcopy->setLimit(1); @@ -600,7 +600,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelect(Criteria \$criteria, \$con = null) + public static function doSelect(Criteria \$criteria, \$con=null) { return ".$this->getPeerClassname()."::populateObjects(".$this->getPeerClassname()."::doSelectRS(\$criteria, \$con)); }"; @@ -628,7 +628,7 @@ if (Propel::isInit()) { * @return ResultSet The resultset object with numerically-indexed fields. * @see ".$this->basePeerClassname."::doSelect() */ - public static function doSelectRS(Criteria \$criteria, \$con = null) + public static function doSelectRS(Criteria \$criteria, \$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -835,7 +835,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert(\$values, \$con = null) + public static function doInsert(\$values, \$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -894,7 +894,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doUpdate(\$values, \$con = null) + public static function doUpdate(\$values, \$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -941,7 +941,7 @@ if (Propel::isInit()) { * * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(\$con = null) + public static function doDeleteAll(\$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -985,13 +985,13 @@ 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 * rethrown wrapped into a PropelException. */ - public static function doDelete(\$values, \$con = null) + public static function doDelete(\$values, \$con=null) { if (\$con === null) { \$con = Propel::getConnection(".$this->getPeerClassname()."::DATABASE_NAME); @@ -1265,7 +1265,7 @@ if (Propel::isInit()) { * * @return mixed TRUE if all columns are valid or the error message of the first invalid column. */ - public static function doValidate(".$table->getPhpName()." \$obj, \$cols = null) + public static function doValidate(".$table->getPhpName()." \$obj, \$cols=null) { \$columns = array(); @@ -1318,7 +1318,7 @@ if (Propel::isInit()) { * @param Connection \$con the connection to use * @return " . $table->getPhpName() . " */ - public static function ".$this->getRetrieveMethodName()."(\$pk, \$con = null) + public static function ".$this->getRetrieveMethodName()."(\$pk, \$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -1368,7 +1368,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function ".$this->getRetrieveMethodName()."s(\$pks, \$con = null) + public static function ".$this->getRetrieveMethodName()."s(\$pks, \$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -1437,7 +1437,7 @@ if (Propel::isInit()) { $clo = strtolower($col->getName()); $script .= ($co++ ? ", " : "") . "$".$clo; } /* foreach */ - $script .= ", \$con = null) + $script .= ", \$con=null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); 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 From 7d648cdb0ac2973ef9f78cf2139bfbec72362b4e Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Mon, 17 Sep 2012 21:01:31 -0400 Subject: [PATCH 2/3] CODE STYLE fixing propel autogenerated classes --- .../om/php5/PHP5BasicObjectBuilder.php | 12 +++---- .../builder/om/php5/PHP5BasicPeerBuilder.php | 34 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) 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 bdb8a4c72..e42110dc5 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 @@ -808,7 +808,7 @@ abstract class ".$this->getClassname()." extends ".ClassTools::classname($this-> * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM * @return an associative array containing the field names (as keys) and field values */ - public function toArray(\$keyType=BasePeer::TYPE_PHPNAME) + public function toArray(\$keyType = BasePeer::TYPE_PHPNAME) { \$keys = ".$this->getPeerClassname()."::getFieldNames(\$keyType); \$result = array("; @@ -835,7 +835,7 @@ abstract class ".$this->getClassname()." extends ".ClassTools::classname($this-> * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM * @return mixed Value of field. */ - public function getByName(\$name, \$type=BasePeer::TYPE_PHPNAME) + public function getByName(\$name, \$type = BasePeer::TYPE_PHPNAME) { \$pos = ".$this->getPeerClassname()."::translateFieldName(\$name, \$type, BasePeer::TYPE_NUM); return \$this->getByPosition(\$pos); @@ -890,7 +890,7 @@ $script .= " * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM * @return void */ - public function setByName(\$name, \$value, \$type=BasePeer::TYPE_PHPNAME) + public function setByName(\$name, \$value, \$type = BasePeer::TYPE_PHPNAME) { \$pos = ".$this->getPeerClassname()."::translateFieldName(\$name, \$type, BasePeer::TYPE_NUM); return \$this->setByPosition(\$pos, \$value); @@ -949,7 +949,7 @@ $script .= " * @param string \$keyType The type of keys the array uses. * @return void */ - public function fromArray(\$arr, \$keyType=BasePeer::TYPE_PHPNAME) + public function fromArray(\$arr, \$keyType = BasePeer::TYPE_PHPNAME) { \$keys = ".$this->getPeerClassname()."::getFieldNames(\$keyType); "; @@ -981,7 +981,7 @@ $script .= " * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ - public function delete(\$con=null) + public function delete(\$con = null) { if (\$this->isDeleted()) { throw new PropelException(\"This object has already been deleted.\"); @@ -1115,7 +1115,7 @@ $script .= " public function validate(\$columns = null) { if (\$columns) { - return ".$this->getPeerClassname()."::doValidate(\$this, \$columns); + return ".$this->getPeerClassname()."::doValidatefromArray(\$this, \$columns); } return ".$this->getPeerClassname()."::doValidate(\$this); } 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 d7d4f6963..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); @@ -297,7 +296,7 @@ if (Propel::isInit()) { * @return array A list of field names */ - static public function getFieldNames(\$type=BasePeer::TYPE_PHPNAME) + static public function getFieldNames(\$type = BasePeer::TYPE_PHPNAME) { if (!array_key_exists(\$type, self::\$fieldNames)) { throw new PropelException('Method getFieldNames() expects the parameter \$type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . \$type . ' was given.'); @@ -528,7 +527,7 @@ if (Propel::isInit()) { * @param Connection \$con * @return int Number of matching rows. */ - public static function doCount(Criteria \$criteria, \$distinct=false, \$con=null) + public static function doCount(Criteria \$criteria, \$distinct = false, \$con = null) { // we're going to modify criteria, so copy it first \$criteria = clone \$criteria; @@ -572,7 +571,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelectOne(Criteria \$criteria, \$con=null) + public static function doSelectOne(Criteria \$criteria, \$con = null) { \$critcopy = clone \$criteria; \$critcopy->setLimit(1); @@ -600,7 +599,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doSelect(Criteria \$criteria, \$con=null) + public static function doSelect(Criteria \$criteria, \$con = null) { return ".$this->getPeerClassname()."::populateObjects(".$this->getPeerClassname()."::doSelectRS(\$criteria, \$con)); }"; @@ -628,7 +627,7 @@ if (Propel::isInit()) { * @return ResultSet The resultset object with numerically-indexed fields. * @see ".$this->basePeerClassname."::doSelect() */ - public static function doSelectRS(Criteria \$criteria, \$con=null) + public static function doSelectRS(Criteria \$criteria, \$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -835,7 +834,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doInsert(\$values, \$con=null) + public static function doInsert(\$values, \$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -894,7 +893,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doUpdate(\$values, \$con=null) + public static function doUpdate(\$values, \$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -941,7 +940,7 @@ if (Propel::isInit()) { * * @return int The number of affected rows (if supported by underlying database driver). */ - public static function doDeleteAll(\$con=null) + public static function doDeleteAll(\$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -991,7 +990,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function doDelete(\$values, \$con=null) + public static function doDelete(\$values, \$con = null) { if (\$con === null) { \$con = Propel::getConnection(".$this->getPeerClassname()."::DATABASE_NAME); @@ -1265,7 +1264,7 @@ if (Propel::isInit()) { * * @return mixed TRUE if all columns are valid or the error message of the first invalid column. */ - public static function doValidate(".$table->getPhpName()." \$obj, \$cols=null) + public static function doValidate(".$table->getPhpName()." \$obj, \$cols = null) { \$columns = array(); @@ -1318,7 +1317,7 @@ if (Propel::isInit()) { * @param Connection \$con the connection to use * @return " . $table->getPhpName() . " */ - public static function ".$this->getRetrieveMethodName()."(\$pk, \$con=null) + public static function ".$this->getRetrieveMethodName()."(\$pk, \$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -1368,7 +1367,7 @@ if (Propel::isInit()) { * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ - public static function ".$this->getRetrieveMethodName()."s(\$pks, \$con=null) + public static function ".$this->getRetrieveMethodName()."s(\$pks, \$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -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()."("; @@ -1437,7 +1436,7 @@ if (Propel::isInit()) { $clo = strtolower($col->getName()); $script .= ($co++ ? ", " : "") . "$".$clo; } /* foreach */ - $script .= ", \$con=null) + $script .= ", \$con = null) { if (\$con === null) { \$con = Propel::getConnection(self::DATABASE_NAME); @@ -1452,7 +1451,8 @@ if (Propel::isInit()) { \$v = ".$this->getPeerClassname()."::doSelect(\$criteria, \$con); return !empty(\$v) ? \$v[0] : null; - }"; + } +"; } /** From 458c6767fa2363a65a61dd886307e60278c9cdc2 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Tue, 18 Sep 2012 10:29:59 -0400 Subject: [PATCH 3/3] fixing an error in propel model, this was a typo error --- .../propel/engine/builder/om/php5/PHP5BasicObjectBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e42110dc5..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 @@ -1115,7 +1115,7 @@ $script .= " public function validate(\$columns = null) { if (\$columns) { - return ".$this->getPeerClassname()."::doValidatefromArray(\$this, \$columns); + return ".$this->getPeerClassname()."::doValidate(\$this, \$columns); } return ".$this->getPeerClassname()."::doValidate(\$this); }