codeigniter, datamapper and ion_auth error is leaving me confused
when i call this-
$o = new Order();
codeigniter gives me this error-
A PHP Error was encountered
Severity: Notice
Message: Undefined property: order::$ion_auth_model
Filename: libraries/Loader.php
Line Number: 1035
Fatal error: Call to a member function _assign_libraries() on a non-object in C:\xampplite\htdocs\portraits\system\libraries\Loader.php on line 1035
At the minute the order model isnt doing anything other than whats in the _template from datamapper 1.8
here is the db schema for the order table
CREATE TABLE IF NOT EXISTS `orders` (
`order_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`image_path` int(11) NOT NULL,
`status` enum('new','progress','completed','sent') NOT NULL,
`placed` date NOT NULL,
`updated_date` date NOT NULL,
`will_send` int(1) NOT NULL,
PRIMARY KEY (`order_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
This is what i was trying to do..
$o->user_id = $user->id;
$o->status = 'new';
$o->placed = unix_to_开发者_Go百科human(time(), TRUE, 'eu');;
$o->will_send = 1;
any guidance on why CI is trying to load the auth model to the user class? or what am i missing here?
- Where is the Order class?
- How do you include it to your code?
- Does Order class standalone? or integrated to CodeIgniter?
- Did you check/change your Ion_Auth config?
- Did you ever tried to change the codes in Ion_Auth?
- Did you try to call a variable from ion_auth that is not exists? (Eg:
$this->ion_auth->order;
or$this->ion_auth_model->order;
) Did you call CI superclass in Order class? If you trying to do access CodeIgniter's classes and functions, you have to get the CI instance inside Order class. Eg;
Class Order { public function __construct() { //Calling CI superclass to use libraries, models, helpers, views etc... $this->ci =& get_instance(); //using CI's libraries: if ($this->ci->ion_auth->logged_in()) { //Do stuff here... } } }
精彩评论