Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1021 and preparation for #1012 #1022

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ protected function addProcessNestedSetQueries(&$script)
$script .= "
/**
* Execute queries that were saved to be run inside the save transaction
*
* @param PropelPDO \$con
*/
protected function processNestedSetQueries(\$con)
protected function processNestedSetQueries(PropelPDO \$con)
{
foreach (\$this->nestedSetQueries as \$query) {
\$query['arguments'][]= \$con;
Expand Down Expand Up @@ -457,7 +459,7 @@ protected function addIsDescendantOf(&$script)
/**
* Tests if node is a descendant of another node
*
* @param $objectClassname \$node Propel node object
* @param $objectClassname \$parent Propel node object
* @return bool
*/
public function isDescendantOf(\$parent)
Expand All @@ -482,7 +484,7 @@ protected function addIsAncestorOf(&$script)
/**
* Tests if node is a ancestor of another node
*
* @param $objectClassname \$node Propel node object
* @param $objectClassname \$child Propel node object
* @return bool
*/
public function isAncestorOf(\$child)
Expand Down Expand Up @@ -996,8 +998,8 @@ protected function addAddChild(&$script)
* are not persisted until the child object is saved.
*
* @param $objectClassname \$child Propel object for child node
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function addChild($objectClassname \$child)
{
Expand Down Expand Up @@ -1033,8 +1035,8 @@ protected function addInsertAsFirstChildOf(&$script)
* are not persisted until the current object is saved.
*
* @param $objectClassname \$parent Propel object for parent node
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function insertAsFirstChildOf(\$parent)
{
Expand Down Expand Up @@ -1078,8 +1080,8 @@ protected function addInsertAsLastChildOf(&$script)
* are not persisted until the current object is saved.
*
* @param $objectClassname \$parent Propel object for parent node
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function insertAsLastChildOf(\$parent)
{
Expand Down Expand Up @@ -1123,8 +1125,8 @@ protected function addInsertAsPrevSiblingOf(&$script)
* are not persisted until the current object is saved.
*
* @param $objectClassname \$sibling Propel object for parent node
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function insertAsPrevSiblingOf(\$sibling)
{
Expand Down Expand Up @@ -1165,8 +1167,8 @@ protected function addInsertAsNextSiblingOf(&$script)
* are not persisted until the current object is saved.
*
* @param $objectClassname \$sibling Propel object for parent node
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function insertAsNextSiblingOf(\$sibling)
{
Expand Down Expand Up @@ -1205,8 +1207,8 @@ protected function addMoveToFirstChildOf(&$script)
*
* @param $objectClassname \$parent Propel object for parent node
* @param PropelPDO \$con Connection to use.
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function moveToFirstChildOf(\$parent, PropelPDO \$con = null)
{
Expand Down Expand Up @@ -1235,8 +1237,8 @@ protected function addMoveToLastChildOf(&$script)
*
* @param $objectClassname \$parent Propel object for parent node
* @param PropelPDO \$con Connection to use.
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function moveToLastChildOf(\$parent, PropelPDO \$con = null)
{
Expand Down Expand Up @@ -1265,8 +1267,8 @@ protected function addMoveToPrevSiblingOf(&$script)
*
* @param $objectClassname \$sibling Propel object for sibling node
* @param PropelPDO \$con Connection to use.
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function moveToPrevSiblingOf(\$sibling, PropelPDO \$con = null)
{
Expand Down Expand Up @@ -1298,8 +1300,8 @@ protected function addMoveToNextSiblingOf(&$script)
*
* @param $objectClassname \$sibling Propel object for sibling node
* @param PropelPDO \$con Connection to use.
*
* @return $objectClassname The current Propel object
* @throws PropelException
*/
public function moveToNextSiblingOf(\$sibling, PropelPDO \$con = null)
{
Expand Down Expand Up @@ -1333,6 +1335,7 @@ protected function addMoveSubtreeTo(&$script)
* @param int \$destLeft Destination left value
* @param int \$levelDelta Delta to add to the levels
* @param PropelPDO \$con Connection to use.
* @throws Exception
*/
protected function moveSubtreeTo(\$destLeft, \$levelDelta" . ($this->behavior->useScope() ? ", \$targetScope = null" : "") . ", PropelPDO \$con = null)
{
Expand Down Expand Up @@ -1439,14 +1442,14 @@ protected function addDeleteDescendants(&$script)
* so existing $objectClassname instances are probably invalid (except for the current one)
*
* @param PropelPDO \$con Connection to use.
*
* @return int number of deleted nodes
* @throws Exception
*/
public function deleteDescendants(PropelPDO \$con = null)
{
if (\$this->isLeaf()) {
// save one query
return;
return 0;
}
if (\$con === null) {
\$con = Propel::getConnection($peerClassname::DATABASE_NAME, Propel::CONNECTION_READ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public function staticAttributes($builder)
* Scope column for the set
*/
const SCOPE_COL = '" . $tableName . '.' . $this->getColumnConstant('scope_column') . "';
";
}else{
$script .= "
/**
* Scope column for the set
*/
const SCOPE_COL = null;
";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function getScopeValue(\$returnNulls = true)
/**
* Wrap the setter for scope value
*
* @param mixed A array or a native type
* @param mixed \$v A array or a native type
* @return {$this->objectClassname}
*/
public function setScopeValue(\$v)
Expand Down Expand Up @@ -539,9 +539,8 @@ protected function addMoveToRank(&$script)
*
* @param integer \$newRank rank value
* @param PropelPDO \$con optional connection
*
* @return {$this->objectClassname} the current object
*
* @throws Exception
* @throws PropelException
*/
public function moveToRank(\$newRank, PropelPDO \$con = null)
Expand Down Expand Up @@ -636,8 +635,8 @@ protected function addMoveUp(&$script)
* Move the object higher in the list, i.e. exchanges its rank with the one of the previous object
*
* @param PropelPDO \$con optional connection
*
* @return {$this->objectClassname} the current object
* @throws Exception
*/
public function moveUp(PropelPDO \$con = null)
{
Expand Down Expand Up @@ -669,8 +668,8 @@ protected function addMoveDown(&$script)
* Move the object higher in the list, i.e. exchanges its rank with the one of the next object
*
* @param PropelPDO \$con optional connection
*
* @return {$this->objectClassname} the current object
* @throws Exception
*/
public function moveDown(PropelPDO \$con = null)
{
Expand Down Expand Up @@ -724,8 +723,8 @@ protected function addMoveToBottom(&$script)
* Move the object to the bottom of the list
*
* @param PropelPDO \$con optional connection
*
* @return integer the old object's rank
* @throws Exception
*/
public function moveToBottom(PropelPDO \$con = null)
{
Expand Down Expand Up @@ -759,8 +758,8 @@ protected function addRemoveFromList(&$script)
* The modifications are not persisted until the object is saved.
*
* @param PropelPDO \$con optional connection
*
* @return {$this->objectClassname} the current object
* @throws PropelException
*/
public function removeFromList(PropelPDO \$con = null)
{";
Expand Down Expand Up @@ -796,8 +795,10 @@ protected function addProcessSortableQueries(&$script)
$script .= "
/**
* Execute queries that were saved to be run inside the save transaction
*
* @param PropelPDO \$con
*/
protected function processSortableQueries(\$con)
protected function processSortableQueries(PropelPDO \$con)
{
foreach (\$this->sortableQueries as \$query) {
\$query['arguments'][]= \$con;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ protected function addGetMaxRank(&$script)
* @param int \$scope Scope to determine which suite to consider";
}
$script .= "
* @param PropelPDO optional connection
*
* @return integer highest position
* @param PropelPDO \$con optional connection
* @return int highest position
*/
public static function getMaxRank(" . ($useScope ? "\$scope = null, " : "") . "PropelPDO \$con = null)
{
Expand Down Expand Up @@ -268,8 +267,8 @@ protected function addReorder(&$script)
*
* @param array \$order id => rank pairs
* @param PropelPDO \$con optional connection
*
* @return boolean true if the reordering took place, false if a database problem prevented it
* @throws Exception
*/
public static function reorder(array \$order, PropelPDO \$con = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ protected function addOrderByRank(&$script)
* Using the default \$order, returns the item with the lowest rank first
*
* @param string \$order either Criteria::ASC (default) or Criteria::DESC
*
* @return " . $this->queryClassname . " The current query, for fluid interface
* @throws PropelException
*/
public function orderByRank(\$order = Criteria::ASC)
{
Expand Down Expand Up @@ -287,8 +287,7 @@ protected function addGetMaxRank(&$script)
";
}
$script .= "
* @param PropelPDO optional connection
*
* @param PropelPDO \$con optional connection
* @return integer highest position
*/
public function getMaxRank(" . ($useScope ? "$methodSignature, " : "") . "PropelPDO \$con = null)
Expand Down Expand Up @@ -326,9 +325,8 @@ protected function addGetMaxRankArray(&$script)
";
}
$script .= "
* @param PropelPDO optional connection
*
* @return integer highest position
* @param PropelPDO \$con optional connection
* @return int highest position
*/
public function getMaxRankArray(" . ($useScope ? "\$scope, " : "") . "PropelPDO \$con = null)
{
Expand Down Expand Up @@ -363,8 +361,8 @@ protected function addReorder(&$script)
*
* @param array \$order id => rank pairs
* @param PropelPDO \$con optional connection
*
* @return boolean true if the reordering took place, false if a database problem prevented it
* @throws Exception
*/
public function reorder(array \$order, PropelPDO \$con = null)
{
Expand Down
19 changes: 11 additions & 8 deletions generator/lib/builder/om/PHP5ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ protected function addEnumAccessor(&$script, Column $col)
* @param PropelPDO \$con An optional PropelPDO connection to use for fetching this lazy-loaded column.";
}
$script .= "
* @return " . $col->getPhpType() . "
* @return " . (strlen($col->getPhpType()) > 0 ? $col->getPhpType() : 'StdClass') . "
* @throws PropelException - if the stored enum key is unknown.
*/";

Expand Down Expand Up @@ -1260,7 +1260,7 @@ public function addDefaultAccessorComment(&$script, Column $col)
* @param PropelPDO \$con An optional PropelPDO connection to use for fetching this lazy-loaded column.";
}
$script .= "
* @return " . $col->getPhpType() . "
* @return " . (strlen($col->getPhpType()) > 0 ? $col->getPhpType() : 'StdClass') . "
*/";
}

Expand Down Expand Up @@ -1493,7 +1493,7 @@ public function addMutatorComment(&$script, Column $col)
/**
* Set the value of [$clo] column.
* " . $col->getDescription() . "
* @param " . $col->getPhpType() . " \$v new value
* @param " . (strlen($col->getPhpType()) == 0 ? 'StdClass' : $col->getPhpType()) . " \$v new value
* @return " . $this->getObjectClassname() . " The current object (for fluent API support)
*/";
}
Expand Down Expand Up @@ -1892,7 +1892,7 @@ protected function addEnumMutator(&$script, Column $col)
/**
* Set the value of [$clo] column.
* " . $col->getDescription() . "
* @param " . $col->getPhpType() . " \$v new value
* @param " . (strlen($col->getPhpType()) == 0 ? 'StdClass' : $col->getPhpType()) . " \$v new value
* @return " . $this->getObjectClassname() . " The current object (for fluent API support)
* @throws PropelException - if the value is not accepted by this enum.
*/";
Expand Down Expand Up @@ -3497,7 +3497,7 @@ protected function addFKAccessor(&$script, ForeignKey $fk)
* Get the associated $className object
*
* @param PropelPDO \$con Optional Connection object.
* @param \$doQuery Executes a query to get the object if required
* @param bool \$doQuery Executes a query to get the object if required
* @return $className The associated $className object.
* @throws PropelException
*/
Expand Down Expand Up @@ -3809,6 +3809,7 @@ protected function addRefFKPartial(&$script, ForeignKey $refFK)
/**
* reset is the $collName collection loaded partially
*
* @param bool \$v
* @return void
*/
public function resetPartial{$relCol}(\$v = true)
Expand Down Expand Up @@ -4105,14 +4106,15 @@ public function set{$relatedName}(PropelCollection \${$inputCollection}, PropelP
protected function addRefFKDoAdd(&$script, $refFK)
{
$relatedObjectClassName = $this->getRefFKPhpNameAffix($refFK, $plural = false);
$relatedObjectName = $this->getNewStubObjectBuilder($refFK->getTable())->getClassname();

$lowerRelatedObjectClassName = lcfirst($relatedObjectClassName);

$collName = $this->getRefFKCollVarName($refFK);

$script .= "
/**
* @param {$relatedObjectClassName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to add.
* @param {$relatedObjectName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to add.
*/
protected function doAdd{$relatedObjectClassName}(\${$lowerRelatedObjectClassName})
{
Expand All @@ -4131,6 +4133,7 @@ protected function addRefFKRemove(&$script, $refFK)
{
$relatedName = $this->getRefFKPhpNameAffix($refFK, $plural = true);
$relatedObjectClassName = $this->getRefFKPhpNameAffix($refFK, $plural = false);
$relatedObjectName = $this->getNewStubObjectBuilder($refFK->getTable())->getClassname();

$inputCollection = lcfirst($relatedName . 'ScheduledForDeletion');
$lowerRelatedObjectClassName = lcfirst($relatedObjectClassName);
Expand All @@ -4142,7 +4145,7 @@ protected function addRefFKRemove(&$script, $refFK)

$script .= "
/**
* @param {$relatedObjectClassName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to remove.
* @param {$relatedObjectName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to remove.
* @return " . $this->getObjectClassname() . " The current object (for fluent API support)
*/
public function remove{$relatedObjectClassName}(\${$lowerRelatedObjectClassName})
Expand Down Expand Up @@ -4637,7 +4640,7 @@ protected function addCrossFKDoAdd(&$script, ForeignKey $refFK, ForeignKey $cros

$script .= "
/**
* @param {$relatedObjectClassName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to add.
* @param {$relatedObjectName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to add.
*/
protected function doAdd{$relatedObjectClassName}({$relatedObjectName} \${$lowerRelatedObjectClassName})
{
Expand Down
Loading