diff options
author | Luis Ramón López <[email protected]> | 2014-01-02 22:05:58 +0100 |
---|---|---|
committer | Simon Holywell <[email protected]> | 2014-04-26 13:33:06 +0100 |
commit | b185d0966bb4893098dbe5cf3d2313e6ab177d17 (patch) | |
tree | dc9367c07ea1efa685dc14a2bf9c9e5f6058ba1a /idiorm.php | |
parent | ef4df3033fdd4fe6faeffeac112b36a24a7e2e96 (diff) |
Added a protected method for filtering multiple column primary keys
Diffstat (limited to 'idiorm.php')
-rw-r--r-- | idiorm.php | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 |