Browse Source

Fixes issue with Sql Server driver when loading fixtures

Sqlserver::describe is expecting a model object (Unlike other drivers which work with either a object or string). While this does work under normal conditions, it causes a "Trying to get property of non-object" notice when using fixtures. The same problem also causes the testLimitOffsetHack test to fail.

This change does a simple test to ensure that the $model variable is an object before trying to access a property of it. All SqlServer tests are now passing.
Walther Lalk 12 years ago
parent
commit
2dd3cecfaa
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/Cake/Model/Datasource/Database/Sqlserver.php

+ 1 - 1
lib/Cake/Model/Datasource/Database/Sqlserver.php

@@ -208,7 +208,7 @@ class Sqlserver extends DboSource {
 		}
 
 		$fields = array();
-		$schema = $model->schemaName;
+		$schema = is_object($model) ? $model->schemaName : false;
 
 		$cols = $this->_execute(
 			"SELECT