summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/TActiveRecordGateway.php
diff options
context:
space:
mode:
authorwei <>2007-02-27 23:27:14 +0000
committerwei <>2007-02-27 23:27:14 +0000
commit4c86659bc90d9134b0f901572c5417aa7d9cec18 (patch)
tree41628a361f9d787d6d906f50a7bcf04682e98907 /framework/Data/ActiveRecord/TActiveRecordGateway.php
parent61e14dd70fb045ac84caf92e688cd3b29b663f3f (diff)
Add comments for scaffold, minor changes to TActiveRecord
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecordGateway.php')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordGateway.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php
index 1486e9c3..c925f3c9 100644
--- a/framework/Data/ActiveRecord/TActiveRecordGateway.php
+++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php
@@ -126,7 +126,10 @@ class TActiveRecordGateway extends TComponent
$conn = $record->getDbConnection();
$inspector = $this->getManager()->getTableInspector($conn);
$table = $this->getTableName($record);
- $data = $this->cacheMetaData($record,$inspector->getTableMetaData($table));
+ $meta = $inspector->getTableMetaData($table);
+ if(count($meta->getColumns()) == 0)
+ throw new TActiveRecordException('ar_invalid_table', $table);
+ $data = $this->cacheMetaData($record,$meta);
}
return $data;
}
@@ -176,7 +179,7 @@ class TActiveRecordGateway extends TComponent
$meta = $this->getMetaData($record);
$command = $meta->getFindByCriteriaCommand($record->getDbConnection(),$criteria);
$this->raiseCommandEvent(TActiveRecordStatementType::Select,$command,$record,$criteria);
- Prado::trace(get_class($record).'::FindRecordsByCriteria('.is_string($criteria) ? $criteria : $criteria->repr().')', 'System.Data.ActiveRecord');
+ Prado::trace(get_class($record).'::FindRecordsByCriteria('.((string)$criteria).')', 'System.Data.ActiveRecord');
return $iterator ? $meta->postQuery($command->query()) : $meta->postQueryRow($command->queryRow());
}
@@ -207,7 +210,7 @@ class TActiveRecordGateway extends TComponent
$meta = $this->getMetaData($record);
$command = $meta->getCountRecordsCommand($record->getDbConnection(),$criteria);
$this->raiseCommandEvent(TActiveRecordStatementType::Select,$command,$record,$criteria);
- Prado::trace(get_class($record).'::CountRecords('.is_string($criteria) ? $criteria : $criteria->repr().')', 'System.Data.ActiveRecord');
+ Prado::trace(get_class($record).'::CountRecords('.((string)$criteria).')', 'System.Data.ActiveRecord');
return intval($command->queryScalar());
}
@@ -281,7 +284,7 @@ class TActiveRecordGateway extends TComponent
$meta = $this->getMetaData($record);
$command = $meta->getDeleteByCriteriaCommand($record->getDBConnection(),$criteria);
$this->raiseCommandEvent(TActiveRecordStatementType::Delete,$command,$record,$criteria);
- Prado::trace(get_class($record).'::DeleteRecordsByCriteria('.is_string($criteria) ? $criteria : $criteria->repr().')', 'System.Data.ActiveRecord');
+ Prado::trace(get_class($record).'::DeleteRecordsByCriteria('.((string)$criteria).')', 'System.Data.ActiveRecord');
return $command->execute();
}