summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorLuis Ramón López <[email protected]>2014-01-02 22:05:58 +0100
committerSimon Holywell <[email protected]>2014-04-26 13:33:06 +0100
commitb185d0966bb4893098dbe5cf3d2313e6ab177d17 (patch)
treedc9367c07ea1efa685dc14a2bf9c9e5f6058ba1a /idiorm.php
parentef4df3033fdd4fe6faeffeac112b36a24a7e2e96 (diff)
Added a protected method for filtering multiple column primary keys
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/idiorm.php b/idiorm.php
index 3795032..4e56569 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -1058,6 +1058,21 @@
return implode(', ', $db_fields);
}
}
+
+ /**
+ * Helper method that filters a column/value array returning only those
+ * columns that belong to a compound primary key.
+ *
+ * If the key contains a column that does not exist in the given array,
+ * a null value will be returned for it.
+ */
+ protected function _get_compound_id_column_values($value) {
+ $filtered = array();
+ foreach($this->_get_id_column_name() as $key) {
+ $filtered[$key] = isset($value[$key]) ? $value[$key] : null;
+ }
+ return $filtered;
+ }
/**
* Add a WHERE column = value clause to your query. Each time