1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
zYne 2007-06-11 15:40:31 +00:00
parent 43af7b69f2
commit 670a961a3b
2 changed files with 10 additions and 28 deletions

View File

@ -75,11 +75,8 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
$this->_root = dirname(__FILE__);
$this->_null = new Doctrine_Null;
Doctrine_Record::initNullObject($this->_null);
Doctrine_Collection::initNullObject($this->_null);
Doctrine_Record_Iterator::initNullObject($this->_null);
Doctrine_Validator::initNullObject($this->_null);
Doctrine_Record_Filter::initNullObject($this->_null);
Doctrine_Object::initNullObject($this->_null);
}
/**

View File

@ -31,17 +31,12 @@
* @since 1.0
* @version $Revision: 1298 $
*/
class Doctrine_Record_Filter
class Doctrine_Record_Filter extends Doctrine_Object
{
/**
* @var Doctrine_Record $_record the record object this filter belongs to
*/
protected $_record;
/**
* @var Doctrine_Null $null a Doctrine_Null object used for extremely fast
* null value testing
*/
private static $null;
/**
* constructor
*
@ -60,16 +55,6 @@ class Doctrine_Record_Filter
{
return $this->_record;
}
/**
* initNullObject
*
* @param Doctrine_Null $null
* @return void
*/
public static function initNullObject(Doctrine_Null $null)
{
self::$null = $null;
}
/**
* setDefaultValues
* sets the default values for records internal data
@ -89,10 +74,10 @@ class Doctrine_Record_Filter
$default = $table->getDefaultValueOf($column);
if ($default === null) {
$default = self::$null;
$default = self::$_null;
}
if ($value === self::$null || $overwrite) {
if ($value === self::$_null || $overwrite) {
$this->_record->rawSet($column, $default);
$modified[] = $column;
$this->_record->state(Doctrine_Record::STATE_TDIRTY);
@ -133,12 +118,12 @@ class Doctrine_Record_Filter
$type = $this->_record->getTable()->getTypeOf($name);
if ( ! isset($tmp[$name])) {
$data[$name] = self::$null;
$data[$name] = self::$_null;
} else {
switch ($type) {
case 'array':
case 'object':
if ($tmp[$name] !== self::$null) {
if ($tmp[$name] !== self::$_null) {
if (is_string($tmp[$name])) {
$value = unserialize($tmp[$name]);
@ -152,7 +137,7 @@ class Doctrine_Record_Filter
}
break;
case 'gzip':
if ($tmp[$name] !== self::$null) {
if ($tmp[$name] !== self::$_null) {
$value = gzuncompress($tmp[$name]);
if ($value === false) {
@ -186,14 +171,14 @@ class Doctrine_Record_Filter
$this->_id = array();
if (count($id) > 1) {
foreach ($id as $name) {
if ($this->_data[$name] === self::$null) {
if ($this->_data[$name] === self::$_null) {
$this->_id[$name] = null;
} else {
$this->_id[$name] = $this->_data[$name];
}
}
} else {
if (isset($this->_data[$id]) && $this->_data[$id] !== self::$null) {
if (isset($this->_data[$id]) && $this->_data[$id] !== self::$_null) {
$this->_id[$id] = $this->_data[$id];
}
}
@ -216,7 +201,7 @@ class Doctrine_Record_Filter
foreach ($array as $k => $v) {
$type = $this->_table->getTypeOf($v);
if ($this->_data[$v] === self::$null) {
if ($this->_data[$v] === self::$_null) {
$a[$v] = null;
continue;
}