[eluser]cpomalo[/eluser]
hello
i'm playing with datamapper in my CI project
i have a model like this
Code:
<?php
class Depts extends DataMapper {
public function __construct()
{
// model constructor
parent::__construct();
}
}
?>
and a controler like this
Code:
class Main extends Controller {
private $data = array();
/*
Intialisation de la classe et chargement des librairies et des helpers
*/
function Main()
{
parent::Controller();
$this->load->helper(array('url','html'));
$this->load->library(array('aulib','parser'));
$this->load->model('depts');
// forcer l'authentification
if (! $this->aulib->isLogged()){
redirect('au/login');
}
if ($this->aulib->isRole('baned'))
redirect('au/blank');
$this->output->enable_profiler(TRUE);
}
/*
Par défaut
*/
function index()
{
$data['title'] = "Accueuil";
$data['contentEmploi'] = " ";
$data['contentLogement'] = " ";
$data['contentSoins'] = " ";
$data['contentAssoc'] = " ";
$departement = new Depts();
$depts_id = $this->aumodel->userInfo($this->aulib->getSessionId(), 'depts_id');
$departement->get_by_depts_id($depts_id);
$data['depts'] = $departement->depts;
$data['contentFormation'] = $departement;
$this->load->view('une',$data);
}
}
?>
the table look like this
Code:
DROP TABLE IF EXISTS `code`.`depts`;
CREATE TABLE `code`.`depts` (
`depts_id` int(10) unsigned NOT NULL,
`depts` varchar(45) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`depts_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
every time i call my controller i get an error
Quote:Fatal error: Class 'dept' not found in C:\eri\prison\codeigniter\system\application\libraries\datamapper.php on line 3005
if i create a model named "dept.php" with same code as depts.php
i get no error
anyone can help me?
thanks
claude