Permalink
Browse files

moved build criteria

  • Loading branch information...
1 parent 8391211 commit 4481b86fd344b30c5173a3f5198ac8781e306386 @mpscholten committed Oct 9, 2013
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/Propel/Generator/Builder/Om/templates/Object/_buildCriteria.php.twig
@@ -0,0 +1,14 @@
+/**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+public function buildCriteria()
+{
+ $criteria = new Criteria({{ builder.tableMapClassName }}::DATABASE_NAME);
+ {% for column in builder.table.columns %}
+ if ($this->isColumnModified({{ builder.columnConstant(column) }})) $criteria->add({{ builder.columnConstant(column) }}, $this->{{ column.name|lower }});
+ {% endfor %}
+
+ return $criteria;
+}

0 comments on commit 4481b86

Please sign in to comment.