|
|
@@ -78,16 +78,17 @@ abstract class Model {
|
|
|
public static function get($id) {
|
|
|
|
|
|
$table = static::$table;
|
|
|
+ $is_compound_key = is_array(static::$id_field);
|
|
|
|
|
|
// Check repo for item
|
|
|
- if(!is_array($id) && isset(static::$repositories[$table][$id])) {
|
|
|
+ if(!$is_compound_key && isset(static::$repositories[$table][$id])) {
|
|
|
return static::$repositories[$table][$id];
|
|
|
}
|
|
|
|
|
|
$id_field = static::$id_field;
|
|
|
$class = get_called_class();
|
|
|
|
|
|
- if(is_array($id_field)) { // Compound key
|
|
|
+ if($is_compound_key) { // Compound key
|
|
|
$args = func_get_args();
|
|
|
$fields = $id_field;
|
|
|
|
|
|
@@ -109,7 +110,7 @@ abstract class Model {
|
|
|
|
|
|
if($object) {
|
|
|
$object = new $class($object);
|
|
|
- if(!is_array($id)) {
|
|
|
+ if(!$is_compound_key) {
|
|
|
static::$repositories[$table][$id] = $object;
|
|
|
}
|
|
|
}
|