This may not be the problem with SS, but I found this old topic, so I'm asking if someone can help with this. I got this same error that DataObjects have been requested before the database is ready. But with my imperfect english I'm not quite sure what does this mean what's said after that. "Please ensure your database connection details are correct, your database has been built, and that you are not trying to query the database in _config.php. in .../sapphire/core/model/DataObject.php on line 2873"
I checked what's on that line in DataObject.php, and it's just that text what's written in error information (DataObjects have been requested....)
The whole part of that code is:
public function instance_get_one($filter, $orderby = null) {
if(!DB::isActive()) {
user_error("DataObjects have been requested before the database is ready. Please ensure your database connection details are correct, your database has been built, and that you are not trying to query the database in _config.php.", E_USER_ERROR);
}
If I check my database connection details in _config.php (which I assume means database name, server, password etc.) they are correct, database does exists, but what's that last one, that "you are not trying to query the database in _config.php"?
The problem occured when I was updating php-version, but changed it back when recieved some error codes that I need to search for more information. When updating php-version, I also changed database password, because it was recommended there in services providers information. When changing back the older version I also changed the password.
edit: And when trying to get to the page with mobile phone it says: "Fatal error: Call to a member function addslashes() on a non-object in .../sapphire/core/Convert.php on line 119"
I don't understand much about these codes, when in that convert.php there's
static function raw2sql($val) {
if(is_array($val)) {
foreach($val as $k => $v) $val[$k] = self::raw2sql($v);
return $val;
} else {
return DB::getConn()->addslashes($val);
}
In silverstripe_version file it says version is 2.4.5
Do I need to flush the page somehow or what could help with this problem?