I’m trying to run the example code available at atk4 website. Downloaded the code, created the models and the generate page. However, when I tried to generate the SQL using http://localhost/demo/atk4-example/?page=generate, I got the following error in apache error log:
[Mon Sep 19 21:35:31 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function getAllHash() on a non-object in /var/www/html/demo/atk4-example/atk4-addons/mvc/Page/SchemaGenerator.php on line 69, referer: http://localhost/demo/atk4-example/?page=generate
Here is the Models:
Category.php:
class Model_Category extends Model_Table {
public $entity_code = 'category_table';
public $table_alias = 'ct';
function init(){
parent::init();
$this->addField('name');
}
}
Job.php:
class Model_Job extends Model_Table {
public $entity_code = 'job_table';
public $table_alias = 'jt';
function init(){
parent::init();
$this->addField('category_id')->refModel('Model_Category');
$this->addField('type');
$this->addField('company');
$this->addField('logo');
$this->addField('url');
$this->addField('position');
$this->addField('location');
$this->addField('description')->type('text');
$this->addField('how_to_apply')->type('text');
$this->addField('is_public')->type('boolean');
$this->addField('is_activated')->type('boolean');
$this->addField('email');
$this->addField('token');
$this->addField('created_dts')->type('timestamp')->system(true);
$this->addField('updated_dts')->type('timestamp')->system(true);
$this->addField('expires_at')->type('date')->system(true);
}
}
page/generate.php:
class page_generate extends Page_SchemaGenerator {}
Am I missing some path settings?
and this line is
meaning that
$this->api->dbis not an object.Take a look at atk4-example/page/dbtest.php. It invokes
$this->api->dbConnect();which probably sets the api->db property.