Terry Tacey Thu Jun 27 17:21:37 -0400 2013

Subject: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) in C:\xampp\htdocs\mvc\libraries\php-activerecord\lib\Model.php on line 7

I'm in the process of creating a mini MVC to brush up on my PHP skills and I seem to have ran into a problem when I try to use active record as my ORM.

One of my random models using active record.

class Hola extends ActiveRecord\Model {    
function __construct() {
$hola = Hola::create(['name' => 'Terry', 'state' => 'MI']);
$hola->save();
}
}

I also have a model class that handles loading the models and connecting to the db

protected function connect()
{        
require_once(ROOT . DS . 'libraries' . DS . 'php-activerecord' . DS . 'ActiveRecord.php');
ActiveRecord\Config::initialize(function($cfg) {
require_once(ROOT . DS . 'config' . DS . 'db.php');
$cfg->set_model_directory(ROOT . DS . 'app' . DS . 'models');
$cfg->set_connections(['development' => 'mysql://' . $db['username'] . ':' . $db['password'] . '@localhost/' . $db['database']]);
});
}

I also have a controller class that extends the model class, I've debuggd through all my problems till this point. This one has me completely stumped. I've looked around on the forums and google and I can't seem to find someone else with an error similar to mine. Maybe it's just something stupid I'm overlooking? Or is it the way I'm setting things up. If you need more code let me know! Thanks.