Welcome Guest, Not a member yet? Register   Sign In
Help me about CI + DM and HMVC
#1

[eluser]Unknown[/eluser]
Hi all,

I have a problem with my project using CI 2.1.3 + DM ORM 1.8.2.1 and HMVC 5.4 at https://bitbucket.org/wiredesignz/codeig...sions-hmvc

In the module "welcome" (application\modules\welcome) has 3 folders: controllers, models, views.

The user_model.php file content in application\modules\welcome\models folder:

Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

class User_model extends DataMapper {
var $table = 'users';
var $model = 'user_model';

// --------------------------------------------------------------------
// Relationships
// --------------------------------------------------------------------

var $has_one = array();
var $has_many = array();

// --------------------------------------------------------------------
// Validation
// --------------------------------------------------------------------

var $validation = array();

// Default to ordering by full_name
var $default_order_by = array('id' => 'asc');

    // --------------------------------------------------------------------

function __construct($id = NULL) {
  parent::__construct($id);
    }

// --------------------------------------------------------------------

function __toString() {
  return empty($this->full_name) ? $this->localize_label('newuser') : $this->full_name;
}

}

/* End of file user_model.php */
/* Location: ./application/models/user_model.php */


The welcome.php file content in application\modules\welcome\controllers folder:

Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MX_Controller {
function __construct() {
  parent::__construct();
}

function index()
{
  $user = new User_model();
  $user->get(1);
  echo $user->full_name;
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

I know that DM did not find path-to-the model folder in example above but I don't know how to setup it in my contronller and model.

I have visited http://ellislab.com/forums/viewthread/178045/P15 but I still don't understand.

Can you help detail about it? Thanks in advance.
#2

[eluser]Unknown[/eluser]
OK, I get it. I was stupid when I did not load datamapper library first. :-P




Theme © iAndrew 2016 - Forum software by © MyBB