Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove BasePeer::CLASS_DEFAULT constant.

This constant, generated by `PHP5PeerBuilder::addConstantsAndAttribute()`, is no longer in use
now that autoloading works for models. Besides, it creates problems (see #183) and complexity
in the code. Removing it is painless - all the tests are green.
  • Loading branch information...
commit e0c16e24f4c04c92c390163c3916288936f67735 1 parent 209e34d
@fzaninotto fzaninotto authored
View
38 generator/lib/builder/om/PHP5PeerBuilder.php
@@ -200,9 +200,6 @@ protected function addConstantsAndAttributes(&$script)
/** the related Propel class for this table */
const OM_CLASS = '$tablePhpName';
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = '".$this->getStubObjectBuilder()->getClasspath()."';
-
/** the related TableMap class for this table */
const TM_CLASS = '".$this->getTableMapClass()."';
@@ -1112,7 +1109,7 @@ public static function populateObjects(PDOStatement \$stmt)
if (!$table->getChildrenColumn()) {
$script .= "
// set the class once to avoid overhead in the loop
- \$cls = ".$this->getPeerClassname()."::getOMClass(false);";
+ \$cls = ".$this->getPeerClassname()."::getOMClass();";
}
$script .= "
@@ -1189,7 +1186,7 @@ public static function populateObject(\$row, \$startcol = 0)
\$cls = ".$this->getPeerClassname()."::OM_CLASS;";
} else {
$script .= "
- \$cls = ".$this->getPeerClassname()."::getOMClass(\$row, \$startcol, false);";
+ \$cls = ".$this->getPeerClassname()."::getOMClass(\$row, \$startcol);";
}
$script .= "
\$obj = new \$cls();
@@ -1215,11 +1212,10 @@ protected function addGetOMClass_Inheritance(&$script)
*
* @param array \$row PropelPDO result row.
* @param int \$colnum Column to examine for OM class information (first is 0).
- * @param boolean \$withPrefix Whether or not to return the path with the class name
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
- public static function getOMClass(\$row, \$colnum, \$withPrefix = true)
+ public static function getOMClass(\$row, \$colnum)
{
try {
";
@@ -1243,9 +1239,6 @@ public static function getOMClass(\$row, \$colnum, \$withPrefix = true)
";
$script .= "
} // switch
- if (!\$withPrefix) {
- \$omClass = substr('.'.\$omClass, strrpos('.'.\$omClass, '.') + 1);
- }
";
} else { /* if not enumerated */
$script .= "
@@ -1272,17 +1265,12 @@ protected function addGetOMClass_NoInheritance(&$script)
/**
* The class that the Peer will make instances of.
*
- * If \$withPrefix is true, the returned path
- * uses a dot-path notation which is tranalted into a path
- * relative to a location on the PHP include_path.
- * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
- * @param boolean \$withPrefix Whether or not to return the path with the class name
- * @return string path.to.ClassName
+ * @return string ClassName
*/
- public static function getOMClass(\$withPrefix = true)
+ public static function getOMClass()
{
- return \$withPrefix ? ".$this->getPeerClassname()."::CLASS_DEFAULT : ".$this->getPeerClassname()."::OM_CLASS;
+ return ".$this->getPeerClassname()."::OM_CLASS;
}
";
}
@@ -1300,7 +1288,7 @@ protected function addGetOMClass_NoInheritance_Abstract(&$script)
* This method must be overridden by the stub subclass, because
* ".$this->getObjectClassname()." is declared abstract in the schema.
*/
- abstract public static function getOMClass(\$withPrefix = true);
+ abstract public static function getOMClass();
";
}
@@ -2180,7 +2168,7 @@ public static function doSelectJoin".$thisTableObjectBuilder->getFKPhpNameAffix(
";
} else {
$script .= "
- \$cls = ".$this->getPeerClassname()."::getOMClass(false);
+ \$cls = ".$this->getPeerClassname()."::getOMClass();
";
}
$script .= "
@@ -2201,7 +2189,7 @@ public static function doSelectJoin".$thisTableObjectBuilder->getFKPhpNameAffix(
";
} else {
$script .= "
- \$cls = ".$joinedTablePeerBuilder->getPeerClassname()."::getOMClass(false);
+ \$cls = ".$joinedTablePeerBuilder->getPeerClassname()."::getOMClass();
";
}
@@ -2412,7 +2400,7 @@ public static function doSelectJoinAll(Criteria \$criteria, \$con = null, \$join
";
} else {
$script .= "
- \$cls = ".$this->getPeerClassname()."::getOMClass(false);
+ \$cls = ".$this->getPeerClassname()."::getOMClass();
";
}
@@ -2459,7 +2447,7 @@ public static function doSelectJoinAll(Criteria \$criteria, \$con = null, \$join
";
} else {
$script .= "
- \$cls = ".$joinedTablePeerBuilder->getPeerClassname()."::getOMClass(false);
+ \$cls = ".$joinedTablePeerBuilder->getPeerClassname()."::getOMClass();
";
} /* $joinTable->getChildrenColumn() */
@@ -2682,7 +2670,7 @@ public static function doSelectJoinAllExcept".$thisTableObjectBuilder->getFKPhpN
";
} else {
$script .= "
- \$cls = ".$this->getPeerClassname()."::getOMClass(false);
+ \$cls = ".$this->getPeerClassname()."::getOMClass();
";
}
@@ -2730,7 +2718,7 @@ public static function doSelectJoinAllExcept".$thisTableObjectBuilder->getFKPhpN
";
} else {
$script .= "
- \$cls = ".$joinedTablePeerBuilder->getPeerClassname()."::getOMClass(false);
+ \$cls = ".$joinedTablePeerBuilder->getPeerClassname()."::getOMClass();
";
} /* $joinTable->getChildrenColumn() */
$script .= "
View
2  generator/lib/builder/om/QueryBuilder.php
@@ -495,7 +495,7 @@ protected function findPkSimple(\$key, \$con)
if ($col = $table->getChildrenColumn()) {
$script .="
- \$cls = {$peerClassname}::getOMClass(\$row, 0, false);
+ \$cls = {$peerClassname}::getOMClass(\$row, 0);
\$obj = new \$cls();";
} else {
$script .="
View
2  runtime/lib/formatter/PropelArrayFormatter.php
@@ -112,7 +112,7 @@ public function &getStructuredArrayFromRow($row)
// determine class to use
if ($modelWith->isSingleTableInheritance()) {
- $class = call_user_func(array($modelWith->getModelPeerName(), 'getOMClass'), $row, $col, false);
+ $class = call_user_func(array($modelWith->getModelPeerName(), 'getOMClass'), $row, $col);
$refl = new ReflectionClass($class);
if ($refl->isAbstract()) {
$col += constant($class . 'Peer::NUM_COLUMNS');
View
4 runtime/lib/formatter/PropelOnDemandFormatter.php
@@ -58,12 +58,12 @@ public function getAllObjectsFromRow($row)
{
$col = 0;
// main object
- $class = $this->isSingleTableInheritance ? call_user_func(array($this->peer, 'getOMClass'), $row, $col, false) : $this->class;
+ $class = $this->isSingleTableInheritance ? call_user_func(array($this->peer, 'getOMClass'), $row, $col) : $this->class;
$obj = $this->getSingleObjectFromRow($row, $class, $col);
// related objects using 'with'
foreach ($this->getWith() as $modelWith) {
if ($modelWith->isSingleTableInheritance()) {
- $class = call_user_func(array($modelWith->getModelPeerName(), 'getOMClass'), $row, $col, false);
+ $class = call_user_func(array($modelWith->getModelPeerName(), 'getOMClass'), $row, $col);
$refl = new ReflectionClass($class);
if ($refl->isAbstract()) {
$col += constant($class . 'Peer::NUM_COLUMNS');
Please sign in to comment.
Something went wrong with that request. Please try again.