In use Gas ORM for CodeIgniter.
Like what said in : http://gasorm-doc.taufanaditya.com/configuration.html
Gas ORM support auto-creation of tables. This mean you can convert your existing Gas models into a database. For security reasons, this option is disabled by default. To enable :
$config['auto_create_tables'] = TRUE;
And then i enable migration in migration.php and then create 2 class in models folder called user.php and blog.php. The code look like :
User class :
<?php
namespace Model;
use \Gas\Core;
use \Gas\ORM;
class User extends ORM {
public $primary_key = 'id';
function _init()
{
self::$relationships = array (
'blog' => ORM::has_many('\\Model\\Blog');
);
self::$fields = array(
'id' => ORM::field('auto[10]'),
'username' => ORM::field('char[64]'),
'password' => ORM::field('char[255]'),
'email' => ORM::field('char[255]'),
);
}
}
Blogclass:
<?php namespace Model;
use \Gas\Core;
use \Gas\ORM;
class Blog extends ORM {
public $primary_key = 'id';
function _init()
{
self::$relationships = array (
'user' => ORM::belongs_to('\\Model\\User')
);
self::$fields = array(
'id' => ORM::field('auto[10]'),
'title' => ORM::field('char[255]', array('required','max_length[255]')),
'body' => ORM::field('string'),
'modified_at' => ORM::field('datetime'),
'created_at' => ORM::field('datetime'),
);
$this->ts_fields = array('modified_at','[created_at]');
}
}
When i refresh the pages, the page showing error:
A PHP Error was encountered
Severity: Runtime Notice
Message: Only variables should be passed by reference
Filename: classes/core.php
Line Number: 2460
Backtrace:
File: /application/third_party/gas/classes/core.php
Line: 2460
Function: _error_handler
File: /application/third_party/gas/classes/core.php
Line: 320
Function: _generate_tables
File: /application/third_party/gas/classes/core.php
Line: 360
Function: __construct
File: /application/third_party/gas/bootstrap.php
Line: 229
Function: make
File: /application/libraries/Gas.php
Line: 111
Function: include_once
File: /application/controllers/Home_Controller.php
Line: 7
Function: __construct
File: /index.php
Line: 315
Function: require_once
I really stuck with this error. Can anyone help me to solve my problem?