I'm facing a problem when I'm using datamapper with codegniter and HMVC module. It didnt work for MX_CONTROLLER .. c
I have followed these steps: http://stensi.com/datamapper/pages/installation.html I have created two modules.
Albums_model:
<?php
class albums_model extends DataMapper {
var $has_many = array('photos_model');
public $table = 'albums';
}
?>
And photos_model:
<?php
class photos_model extends DataMapper {
public $table = 'photos';
public $validation= array(
array(
'field' => 'title',
'label' => 'Title',
'rules'=>array('required')
)
);
?>
Photos controller:
<?php
class Photos extends MX_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('photos_model');
}
function index()
{
$p=new photos_model();
$p= $this->photos_model->get();
print_r($p);
}
}
?>
Where is the problem? Can anyone help me?
By the way, is there any $belong_to
option similar to cakephp?