From b185d0966bb4893098dbe5cf3d2313e6ab177d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Ram=C3=B3n=20L=C3=B3pez?= Date: Thu, 2 Jan 2014 22:05:58 +0100 Subject: Added a protected method for filtering multiple column primary keys --- idiorm.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- cgit v1.2.3