Permalink
Browse files

Fixing fatal errors when running postgres

  • Loading branch information...
1 parent df303f9 commit 783b5d4d1c350d38d0e6d1d92d531e87da6f4da1 @lorenzo lorenzo committed Sep 3, 2011
Showing with 8 additions and 4 deletions.
  1. +7 −3 lib/Cake/Model/Datasource/DataSource.php
  2. +1 −1 lib/Cake/Model/Datasource/Database/Postgres.php
@@ -114,14 +114,18 @@ public function listSources($data = null) {
/**
* 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;
}
- $table = $model->tablePrefix . $model->table;
+ if (is_string($model)) {
+ $table = $model;
+ } else {
+ $table = $model->tablePrefix . $model->table;
+ }
if (isset($this->_descriptions[$table])) {
return $this->_descriptions[$table];
@@ -186,7 +186,7 @@ public function listSources($data = null) {
* @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();

0 comments on commit 783b5d4

Please sign in to comment.