From 65dda2deb497d86ae96e12e62258776b71ebc7dc Mon Sep 17 00:00:00 2001 From: rojaro <> Date: Sun, 1 Nov 2009 20:54:03 +0000 Subject: merged active record default value bug fix which got lost when moving from trac to googlecode - see http://www.pradosoft.com/forum/index.php?topic=10603.0 --- framework/Data/ActiveRecord/TActiveRecordGateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'framework/Data') diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php index e588b976..a61ae0ff 100644 --- a/framework/Data/ActiveRecord/TActiveRecordGateway.php +++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php @@ -306,7 +306,7 @@ class TActiveRecordGateway extends TComponent if($column->getIsExcluded()) continue; $value = $record->getColumnValue($name); - if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && !$column->getDefaultValue()) + if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE)) { throw new TActiveRecordException( 'ar_value_must_not_be_null', get_class($record), @@ -342,7 +342,7 @@ class TActiveRecordGateway extends TComponent if($column->getIsExcluded()) continue; $value = $record->getColumnValue($name); - if(!$column->getAllowNull() && $value===null) + if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE)) { throw new TActiveRecordException( 'ar_value_must_not_be_null', get_class($record), -- cgit v1.2.3