Fixed ticket #26
This commit is contained in:
parent
d283fbf1c7
commit
cfa6a512f3
@ -586,6 +586,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
final public function internalSet($name, $value) {
|
final public function internalSet($name, $value) {
|
||||||
|
if($value === null)
|
||||||
|
$value = self::$null;
|
||||||
|
|
||||||
$this->data[$name] = $value;
|
$this->data[$name] = $value;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -618,6 +621,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
if($this->state == Doctrine_Record::STATE_TCLEAN)
|
if($this->state == Doctrine_Record::STATE_TCLEAN)
|
||||||
$this->state = Doctrine_Record::STATE_TDIRTY;
|
$this->state = Doctrine_Record::STATE_TDIRTY;
|
||||||
|
|
||||||
|
if($value === null)
|
||||||
|
$value = self::$null;
|
||||||
|
|
||||||
$this->data[$name] = $value;
|
$this->data[$name] = $value;
|
||||||
$this->modified[] = $name;
|
$this->modified[] = $name;
|
||||||
}
|
}
|
||||||
@ -646,6 +652,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
$old = $this->get($name);
|
$old = $this->get($name);
|
||||||
|
|
||||||
if($old !== $value) {
|
if($old !== $value) {
|
||||||
|
if($value === null)
|
||||||
|
$value = self::$null;
|
||||||
|
|
||||||
$this->data[$name] = $value;
|
$this->data[$name] = $value;
|
||||||
$this->modified[] = $name;
|
$this->modified[] = $name;
|
||||||
switch($this->state):
|
switch($this->state):
|
||||||
@ -797,7 +806,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
$this->data[$v] = $this->data[$v]->getIncremented();
|
$this->data[$v] = $this->data[$v]->getIncremented();
|
||||||
}
|
}
|
||||||
|
|
||||||
$a[$v] = $this->data[$v];
|
if($this->data[$v] === self::$null)
|
||||||
|
$a[$v] = null;
|
||||||
|
else
|
||||||
|
$a[$v] = $this->data[$v];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->table->getInheritanceMap() as $k => $v) {
|
foreach($this->table->getInheritanceMap() as $k => $v) {
|
||||||
|
@ -93,7 +93,21 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
|
|||||||
|
|
||||||
$this->assertEqual($coll->count(), 1);
|
$this->assertEqual($coll->count(), 1);
|
||||||
}
|
}
|
||||||
|
public function testUpdatingWithNullValue() {
|
||||||
|
$user = $this->connection->getTable('User')->find(5);
|
||||||
|
$user->name = null;
|
||||||
|
$this->assertEqual($user->name, null);
|
||||||
|
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$this->assertEqual($user->name, null);
|
||||||
|
|
||||||
|
$this->connection->clear();
|
||||||
|
|
||||||
|
$user = $this->connection->getTable('User')->find(5);
|
||||||
|
$this->assertEqual($user->name, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testDateTimeType() {
|
public function testDateTimeType() {
|
||||||
$date = new DateTest();
|
$date = new DateTest();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user