I am trying to do a CRUD as mentioned in Jobeet tutorial(http://agiletoolkit.org/learn/tutorial/jobeet/day3). I have also added a generate.php inside page directory with the code mentioned in the link. When I try to access it via browser by http://localhost/atk4.1.2/?page=generate I am getting the following error,
Exception_ForUser
You should call parent::init() when you override it
Additional information:
- object_name: gift_project_generate
- class: page_generate
I also have added a page named crud.php with the following contents inside the page directory the contents of which are as follows,
<?php
class page_crud extends Page{
function init(){
parent::init();
$tabs=$this->add('Tabs');
$tabs->addTab('Gifts')->add('CRUD')->setModel('Gift');
}
}
The following is the Gift.php inside the Model directory,
<?php
class Model_Gift extends Model_Table {
function init(){
parent::init();
$this->addField('id');
$this->addField('name')->type('text');
$this->addField('url')->type('text');
}
}
Now when I try to access the crud page via http://localhost/atk4.1.2/?page=crud, I see the following errors,
Exception_InitError
You should define entity code for Model_Gift
C:\xampp\htdocs\atk4.1.2\atk4\lib\BaseException.php:37
But the database already has a table named gift and $this->dbConnect(); is not commented in Frontend.php.
Am I missing something here?
Add this to your model definition:
This should be exactly same as the name of your table in SQL.
The other error you are getting about init() not being called is a bug: https://github.com/atk4/atk4/issues/22