diff --git a/generator/lib/behavior/nestedset/NestedSetBehaviorObjectBuilderModifier.php b/generator/lib/behavior/nestedset/NestedSetBehaviorObjectBuilderModifier.php index a208a9765..e67a77b73 100644 --- a/generator/lib/behavior/nestedset/NestedSetBehaviorObjectBuilderModifier.php +++ b/generator/lib/behavior/nestedset/NestedSetBehaviorObjectBuilderModifier.php @@ -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; @@ -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) @@ -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) @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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); diff --git a/generator/lib/behavior/nestedset/NestedSetBehaviorPeerBuilderModifier.php b/generator/lib/behavior/nestedset/NestedSetBehaviorPeerBuilderModifier.php index 75d9d5b90..ee8200f3c 100644 --- a/generator/lib/behavior/nestedset/NestedSetBehaviorPeerBuilderModifier.php +++ b/generator/lib/behavior/nestedset/NestedSetBehaviorPeerBuilderModifier.php @@ -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; "; } diff --git a/generator/lib/behavior/sortable/SortableBehaviorObjectBuilderModifier.php b/generator/lib/behavior/sortable/SortableBehaviorObjectBuilderModifier.php index 5f965d591..f87860a3b 100644 --- a/generator/lib/behavior/sortable/SortableBehaviorObjectBuilderModifier.php +++ b/generator/lib/behavior/sortable/SortableBehaviorObjectBuilderModifier.php @@ -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) @@ -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) @@ -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) { @@ -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) { @@ -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) { @@ -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) {"; @@ -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; diff --git a/generator/lib/behavior/sortable/SortableBehaviorPeerBuilderModifier.php b/generator/lib/behavior/sortable/SortableBehaviorPeerBuilderModifier.php index 85ac11bda..eb1f5bb72 100644 --- a/generator/lib/behavior/sortable/SortableBehaviorPeerBuilderModifier.php +++ b/generator/lib/behavior/sortable/SortableBehaviorPeerBuilderModifier.php @@ -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) { @@ -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) { diff --git a/generator/lib/behavior/sortable/SortableBehaviorQueryBuilderModifier.php b/generator/lib/behavior/sortable/SortableBehaviorQueryBuilderModifier.php index a0e7e8ee7..ede802943 100644 --- a/generator/lib/behavior/sortable/SortableBehaviorQueryBuilderModifier.php +++ b/generator/lib/behavior/sortable/SortableBehaviorQueryBuilderModifier.php @@ -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) { @@ -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) @@ -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) { @@ -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) { diff --git a/generator/lib/builder/om/PHP5ObjectBuilder.php b/generator/lib/builder/om/PHP5ObjectBuilder.php index a68e1cd36..9a1353b28 100644 --- a/generator/lib/builder/om/PHP5ObjectBuilder.php +++ b/generator/lib/builder/om/PHP5ObjectBuilder.php @@ -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. */"; @@ -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') . " */"; } @@ -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) */"; } @@ -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. */"; @@ -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 */ @@ -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) @@ -4105,6 +4106,7 @@ 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); @@ -4112,7 +4114,7 @@ protected function addRefFKDoAdd(&$script, $refFK) $script .= " /** - * @param {$relatedObjectClassName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to add. + * @param {$relatedObjectName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to add. */ protected function doAdd{$relatedObjectClassName}(\${$lowerRelatedObjectClassName}) { @@ -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); @@ -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}) @@ -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}) { diff --git a/generator/lib/builder/om/PHP5PeerBuilder.php b/generator/lib/builder/om/PHP5PeerBuilder.php index e22fcc3cb..a6ee73e56 100644 --- a/generator/lib/builder/om/PHP5PeerBuilder.php +++ b/generator/lib/builder/om/PHP5PeerBuilder.php @@ -245,7 +245,8 @@ protected function addConstantsAndAttributes(&$script) * An identity map to hold any loaded instances of " . $this->getObjectClassname() . " objects. * This must be public so that other peer classes can access this when hydrating from JOIN * queries. - * @var array " . $this->getObjectClassname() . "[] + * + * @var " . $this->getObjectClassname() . "[] */ public static \$instances = array(); @@ -488,6 +489,7 @@ protected function addGetValueSets(&$script) $script .= " /** * Gets the list of values for all ENUM columns + * * @return array */ public static function getValueSets() @@ -510,8 +512,8 @@ protected function addGetValueSet(&$script) * Gets the list of values for an ENUM column * * @param string \$colname The ENUM column name. - * * @return array list of possible values for the column + * @throws PropelException */ public static function getValueSet(\$colname) { @@ -540,8 +542,8 @@ protected function addGetSqlValueForEnum(&$script) * * @param string \$colname ENUM column name. * @param string \$enumVal ENUM value. - * * @return int SQL value + * @throws PropelException */ public static function getSqlValueForEnum(\$colname, \$enumVal) { @@ -665,6 +667,7 @@ protected function addAlias(&$script) * \$c->addAlias(\"alias1\", TablePeer::TABLE_NAME); * \$c->addJoin(TablePeer::alias(\"alias1\", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); * + * * @param string \$alias The alias for the current table. * @param string \$column The column name for current table. (i.e. " . $this->getPeerClassname() . "::COLUMN_NAME). * @return string @@ -849,9 +852,9 @@ protected function addDoSelectStmt(&$script) * * @param Criteria \$criteria The Criteria object used to build the SELECT statement. * @param PropelPDO \$con The connection to use + * @return PDOStatement The executed PDOStatement object. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return PDOStatement The executed PDOStatement object. * @see " . $this->basePeerClassname . "::doSelect() */ public static function doSelectStmt(Criteria \$criteria, PropelPDO \$con = null) @@ -967,7 +970,6 @@ protected function addRemoveInstanceFromPool(&$script) * from the cache in order to prevent returning objects that no longer exist. * * @param mixed \$value A " . $this->getObjectClassname() . " object or a primary key value. - * * @return void * @throws PropelException - if the value is invalid. */ @@ -1024,6 +1026,7 @@ protected function addClearInstancePool(&$script) /** * Clear the instance pool. * + * @param bool \$and_clear_all_references * @return void */ public static function clearInstancePool(\$and_clear_all_references = false) @@ -1224,6 +1227,8 @@ protected function addPopulateObjects(&$script) * The returned array will contain objects of the default type or * objects that inherit from the default. * + * @param PDOStatement \$stmt + * @return array * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ @@ -1286,9 +1291,9 @@ protected function addPopulateObject(&$script) * * @param array \$row PropelPDO resultset row. * @param int \$startcol The 0-based offset for reading from the resultset row. + * @return array (" . $this->getStubObjectBuilder()->getClassName() . " object, last column rank) * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (" . $this->getStubObjectBuilder()->getClassName() . " object, last column rank) */ public static function populateObject(\$row, \$startcol = 0) { @@ -1396,7 +1401,8 @@ protected function addGetOMClass_NoInheritance(&$script) /** * The class that the Peer will make instances of. * - * + * @param int \$row + * @param int \$colnum * @return string ClassName */ public static function getOMClass(\$row = 0, \$colnum = 0) @@ -1419,6 +1425,9 @@ protected function addGetOMClass_NoInheritance_Abstract(&$script) * * This method must be overridden by the stub subclass, because * " . $this->getObjectClassname() . " is declared abstract in the schema. + * + * @param int \$row + * @param int \$colnum */"; if (version_compare(PHP_VERSION, '5.3.0', '>=')) { @@ -1450,6 +1459,7 @@ protected function addDoInsert(&$script) * @param mixed \$values Criteria or " . $this->getObjectClassname() . " object containing data that is used to create the INSERT statement. * @param PropelPDO \$con the PropelPDO connection to use * @return mixed The new primary key. + * @throws Exception * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ @@ -1581,6 +1591,7 @@ protected function addDoDeleteAll(&$script) * * @param PropelPDO \$con the connection to use * @return int The number of affected rows (if supported by underlying database driver). + * @throws Exception * @throws PropelException */ public static function doDeleteAll(PropelPDO \$con = null) @@ -1637,6 +1648,7 @@ protected function addDoDelete(&$script) * @param PropelPDO \$con the connection to use * @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 Exception * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ @@ -1958,7 +1970,6 @@ protected function addDoValidate(&$script) * * @param " . $this->getObjectClassname() . " \$obj The object to validate. * @param mixed \$cols Column name or array of column names. - * * @return mixed TRUE if all columns are valid or the error message of the first invalid column. */ public static function doValidate(\$obj, \$cols = null) diff --git a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php index cf36b755c..8812274cf 100644 --- a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php @@ -1433,7 +1433,7 @@ public function testDeleteDescendants() | \ t6 t7 */ - $this->assertNull($t2->deleteDescendants(), 'deleteDescendants() returns null leafs'); + $this->assertEquals(0, $t2->deleteDescendants(), 'deleteDescendants() returns 0 leafs'); $this->assertEquals(4, $t3->deleteDescendants(), 'deleteDescendants() returns the number of deleted nodes'); $this->assertEquals(5, $t3->getRightValue(), 'deleteDescendants() updates the current node'); $this->assertEquals(5, $t4->getLeftValue(), 'deleteDescendants() does not update existing nodes (because delete() clears the instance cache)');