Permalink
Browse files

moved buildPkeyCriteria

  • Loading branch information...
1 parent d69916d commit 83912116d0f7c3bff1d6d82228457e1d2b55e3da @mpscholten committed Oct 9, 2013
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/Propel/Generator/Builder/Om/templates/Object/_buildPkeyCriteria.php.twig
@@ -0,0 +1,19 @@
+{# TODO: maybe rename to buildPKCriteria ?? #}
+/**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+
+public function buildPkeyCriteria()
+{
+ $criteria = new Criteria({{ builder.tableMapClassName }}::DATABASE_NAME);
+ {% for column in table.primaryKey %}
+ $criteria->add({{ builder.columnConstant(column) }}, $this->{{ column.name|lower }});";
+ {% endfor %}
+
+ return $criteria;
+}

0 comments on commit 8391211

Please sign in to comment.