Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #494 from havvg/feature/fk-fluent-api

add more fluent FK api
  • Loading branch information...
commit b9aad6b6c76f48928ec87a0b0e9a0dd29cd1dfad 2 parents 65c62d4 + b9ce9a8
@willdurand willdurand authored
Showing with 22 additions and 5 deletions.
  1. +22 −5 generator/lib/builder/om/PHP5ObjectBuilder.php
View
27 generator/lib/builder/om/PHP5ObjectBuilder.php
@@ -2066,7 +2066,7 @@ protected function addHydrateBody(&$script)
\$this->ensureConsistency();
}
\$this->postHydrate(\$row, \$startcol, \$rehydrate);";
-
+
$this->applyBehaviorModifier('postHydrate', $script, " ");
$script .= "
@@ -3544,13 +3544,15 @@ protected function addRefFKClear(&$script, ForeignKey $refFK)
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
- * @return void
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
* @see add$relCol()
*/
public function clear$relCol()
{
\$this->$collName = null; // important to set this to null since that means it is uninitialized
\$this->{$collName}Partial = null;
+
+ return \$this;
}
";
} // addRefererClear()
@@ -3810,6 +3812,7 @@ protected function addRefFKSet(&$script, $refFK)
*
* @param PropelCollection \${$inputCollection} A Propel collection.
* @param PropelPDO \$con Optional connection object
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
*/
public function set{$relatedName}(PropelCollection \${$inputCollection}, PropelPDO \$con = null)
{
@@ -3826,6 +3829,8 @@ public function set{$relatedName}(PropelCollection \${$inputCollection}, PropelP
\$this->{$collName} = \${$inputCollection};
\$this->{$collName}Partial = false;
+
+ return \$this;
}
";
}
@@ -3881,6 +3886,7 @@ protected function addRefFKRemove(&$script, $refFK)
$script .= "
/**
* @param {$relatedObjectClassName} \${$lowerRelatedObjectClassName} The $lowerRelatedObjectClassName object to remove.
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
*/
public function remove{$relatedObjectClassName}(\${$lowerRelatedObjectClassName})
{
@@ -3893,6 +3899,8 @@ public function remove{$relatedObjectClassName}(\${$lowerRelatedObjectClassName}
\$this->{$inputCollection}[]= \${$lowerRelatedObjectClassName};
\${$lowerRelatedObjectClassName}->set{$relCol}(null);
}
+
+ return \$this;
}
";
}
@@ -4119,13 +4127,15 @@ protected function addCrossFKClear(&$script, ForeignKey $crossFK)
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
- * @return void
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
* @see add$relCol()
*/
public function clear$relCol()
{
\$this->$collName = null; // important to set this to null since that means it is uninitialized
\$this->{$collName}Partial = null;
+
+ return \$this;
}
";
} // addRefererClear()
@@ -4229,6 +4239,7 @@ protected function addCrossFKSet(&$script, $refFK, $crossFK)
*
* @param PropelCollection \${$inputCollection} A Propel collection.
* @param PropelPDO \$con Optional connection object
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
*/
public function set{$relatedNamePlural}(PropelCollection \${$inputCollection}, PropelPDO \$con = null)
{
@@ -4244,6 +4255,8 @@ public function set{$relatedNamePlural}(PropelCollection \${$inputCollection}, P
}
\$this->$collName = \${$inputCollection};
+
+ return \$this;
}
";
}
@@ -4314,7 +4327,7 @@ protected function addCrossFKAdd(&$script, ForeignKey $refFK, ForeignKey $crossF
* through the " . $tblFK->getName() . " cross reference table.
*
* @param " . $crossObjectClassName . " " . $crossObjectName . " The $className object to relate
- * @return void
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
*/
public function add{$relatedObjectClassName}($crossObjectClassName $crossObjectName)
{
@@ -4326,6 +4339,8 @@ public function add{$relatedObjectClassName}($crossObjectClassName $crossObjectN
\$this->" . $collName . "[]= " . $crossObjectName . ";
}
+
+ return \$this;
}
";
}
@@ -4393,7 +4408,7 @@ protected function addCrossFKRemove(&$script, ForeignKey $refFK, ForeignKey $cro
* through the {$tblFK->getName()} cross reference table.
*
* @param {$crossObjectClassName} {$crossObjectName} The $className object to relate
- * @return void
+ * @return ".$this->getObjectClassname()." The current object (for fluent API support)
*/
public function remove{$relatedObjectClassName}($crossObjectClassName $crossObjectName)
{
@@ -4405,6 +4420,8 @@ public function remove{$relatedObjectClassName}($crossObjectClassName $crossObje
}
\$this->{$M2MScheduledForDeletion}[]= {$crossObjectName};
}
+
+ return \$this;
}
";
}
Please sign in to comment.
Something went wrong with that request. Please try again.