I moved a project from a server that had a PHP 5.3 installation to another, more modern one that has PHP 5.6. Now the part of the code where ActiveRecord’s find() is used for the first time causes the following error:
Fatal error: Call to undefined method Locale::attachBehaviors() in /var/www/lib/yii-1.1.16.bca042/framework/db/ar/CActiveRecord.php on line 396
Locale is a custom class that is inheriting from CActiveRecord. The class has the usual required functions defined:
public function tableName(){...}
public static function model($className=__CLASS__)[...}
The "with()"- part that is causing the error is in a base controller where find() is used like this:
Yes, it is 1.1.16. A clean project worked well and then I continued by adding Locale and User classes to the models directory to emulate the issue. All worked well right until I added the find() part to the default SiteController, used by the clean test project. Without the "with()" part, the user was loaded normally but the "with()" activated the "Call to undefined method Locale::attachBehaviors()" error. Here is attached a screenshot.
Set up using DigitalOcean’s minimal Debian setup with 512 MB of memory. Its version is “Debian GNU/Linux 8.2 (jessie)”. The package manager was used to install the latest nginx, php5-related packages and the guidelines were followed to set it up so that it works with Yii.
I am using a separate server for the database, and both servers are set up into a local network. My database connection string looks like this: