MINOR: Updated DataObject::buildSQL() to use DB::getConn() to check to see if a DB connection has been intialised rather than ManifestBuilder::has_been_included().

This commit is contained in:
ajshort 2011-02-26 18:10:21 +11:00
parent 825242eba1
commit 9caf597aee

View File

@ -2605,8 +2605,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// Get the tables to join to
$tableClasses = ClassInfo::dataClassesFor($this->class);
if(!$tableClasses) {
if(!ManifestBuilder::has_been_included()) {
user_error("DataObjects have been requested before the manifest is loaded. Please ensure you are not querying the database in _config.php.", E_USER_ERROR);
if (!DB::getConn()) {
throw new Exception('DataObjects have been requested before'
. ' a DB connection has been made. Please ensure you'
. ' are not querying the database in _config.php.');
} else {
user_error("DataObject::buildSQL: Can't find data classes (classes linked to tables) for $this->class. Please ensure you run dev/build after creating a new DataObject.", E_USER_ERROR);
}