/** * Get a hash from the primary key * * @param string $id The primary key value * * @return array The hash */ protected function getHash($id) { $id = $this->getDS()->escape($id); $sep = "|"; $key = $this->_key; $key_multi = strpos($key, $sep) !== false; $values_multi = ""; if (!$key_multi) { $where = "{$key} = '{$id}'"; } else { $cols = array_combine(explode($sep, $key), explode($sep, $id)); $values_multi = implode("|", $cols); $where = array(); foreach ($cols as $_col => $_value) { $where[] = "{$_col} = '{$_value}'"; } $where = implode(" AND ", $where); } $query = $this->getSelectQuery($where); $hash = $this->_ds->loadHash($query); if ($hash && $key_multi) { $hash[$key] = $values_multi; } if ($hash == false) { return $hash; } return $hash; }