Fixing fatal errors when running postgres

This commit is contained in:
Jose Lorenzo Rodriguez 2011-09-03 11:27:58 -04:30
parent df303f9e09
commit 783b5d4d1c
2 changed files with 8 additions and 4 deletions

View file

@ -114,14 +114,18 @@ class DataSource extends Object {
/**
* Returns a Model description (metadata) or null if none found.
*
* @param Model $model
* @param Model|string $model
* @return array Array of Metadata for the $model
*/
public function describe(Model $model) {
public function describe($model) {
if ($this->cacheSources === false) {
return null;
}
if (is_string($model)) {
$table = $model;
} else {
$table = $model->tablePrefix . $model->table;
}
if (isset($this->_descriptions[$table])) {
return $this->_descriptions[$table];

View file

@ -186,7 +186,7 @@ class Postgres extends DboSource {
* @param Model $model Name of database table to inspect
* @return array Fields in table. Keys are name and type
*/
public function describe(Model $model) {
public function describe($model) {
$fields = parent::describe($model);
$table = $this->fullTableName($model, false);
$this->_sequenceMap[$table] = array();