Any closer and it would be done

Had to rework the Model class a bit, there's some weirdness happening and I'm
unsure if it's part of the rewrite or always been busted. Won't really know for
sure until I start porting sites over to it I suppose.
This commit is contained in:
Joshua Sherman 2014-01-20 01:06:22 -05:00
parent db6e169f7b
commit 54cb6dfe83
2 changed files with 147 additions and 23 deletions

View file

@ -1194,8 +1194,6 @@ class Model extends Object
$sql .= ', ' . $values;
}
$record_field_count = count($record);
foreach ($record as $variable => $value)
{
$input_parameters[] = (is_array($value) ? json_encode($value) : $value);
@ -1205,19 +1203,12 @@ class Model extends Object
if ($this->columns['created_at'] != false)
{
$input_parameters[] = Time::timestamp();
$record_field_count++;
}
// @todo Check if the column was passed in
if ($this->columns['created_id'] != false && isset($_SESSION['__pickles']['security']['user_id']))
{
$input_parameters[] = $_SESSION['__pickles']['security']['user_id'];
$record_field_count++;
}
if ($record_field_count != $field_count)
{
throw new Exception('Record does not match the excepted field count.');
}
}
}
@ -1402,9 +1393,7 @@ class Model extends Object
// Executes the query
if ($this->postgresql && $update == false)
{
$results = $this->db->fetch($sql, $input_parameters);
return $results[0][$this->columns['id']];
return $this->db->fetch($sql, $input_parameters);
}
else
{