diff options
author | wei <> | 2007-02-19 02:23:19 +0000 |
---|---|---|
committer | wei <> | 2007-02-19 02:23:19 +0000 |
commit | 826a0ceb950872bb311addd24c1a8da76a1cccc6 (patch) | |
tree | da833758be6a683a4cada41c417a522698705758 /framework/Data/ActiveRecord/Vendor/TDbMetaData.php | |
parent | db1a9b1af8aee6d5967e96d3f8928d1576c45daf (diff) |
Add trace to active records and TDbCommand
Diffstat (limited to 'framework/Data/ActiveRecord/Vendor/TDbMetaData.php')
-rw-r--r-- | framework/Data/ActiveRecord/Vendor/TDbMetaData.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/framework/Data/ActiveRecord/Vendor/TDbMetaData.php b/framework/Data/ActiveRecord/Vendor/TDbMetaData.php index 3a959ba4..a3a13120 100644 --- a/framework/Data/ActiveRecord/Vendor/TDbMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TDbMetaData.php @@ -212,15 +212,26 @@ abstract class TDbMetaData extends TComponent /**
* Gets the columns that can be inserted into the database.
+ * Missing properties are assumed to be null.
* @param TActiveRecord record object to be inserted.
* @return array name value pairs of fields to be added.
+ * @throws TActiveRecordException if property is null and table column is
+ * defined as not null unless primary key column.
*/
protected function getInsertableColumns($record)
{
$columns = array();
foreach($this->getColumns() as $name=>$column)
{
- $value = $record->{$name};
+ try
+ {
+ $value = $record->{$name};
+ }
+ catch (TInvalidOperationException $e) //ignore missing properties
+ {
+ $value = null;
+ }
+
if($column->getNotNull() && $value===null && !$column->getIsPrimaryKey())
{
throw new TActiveRecordException(
|