Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

object updates

fix bug where you try to select an object by an old unique field after changing the field value
use "json" as default json field in database vs. data
update version to 1.0.3
  • Loading branch information...
commit 0e8134448cb2f8c7aef15aed292b9be1d31bfd27 1 parent 3eb7a2f
Craig Campbell authored
Showing with 10 additions and 2 deletions.
  1. +9 −1 orm/Object.php
  2. +1 −1  orm/_manifest.php
10 orm/Object.php
View
@@ -341,6 +341,9 @@ protected static function _getMultiple(array $ids)
*/
protected static function _getSingle($column, $value)
{
+ $initial_column = $column;
+ $initial_value = $value;
+
$class = get_called_class();
$definition = self::getDefinition($class);
@@ -381,6 +384,11 @@ protected static function _getSingle($column, $value)
return null;
}
+ // fix bug where old items are not removed from cache if the value of the column changes
+ if ($object->$initial_column != $initial_value) {
+ return null;
+ }
+
return $object;
}
@@ -417,7 +425,7 @@ public function json($db_field, $json_key = self::JSON_GET, $value = self::JSON_
if (!$this->_propertyExists($original_field)) {
$value = $json_key;
$json_key = $db_field;
- $db_field = 'data';
+ $db_field = 'json';
}
if (!$this->_propertyExists($db_field) || ($original_field != $db_field && $original_value !== self::JSON_GET)) {
2  orm/_manifest.php
View
@@ -10,7 +10,7 @@
*/
class Orm extends Manifest
{
- const VERSION = "1.0.2";
+ const VERSION = "1.0.3";
protected $_dependencies = array('Database', 'Cache');
protected $_instructions = "Check out http://sonicframework.com/tutorial/orm for help getting started";
}
Please sign in to comment.
Something went wrong with that request. Please try again.