[英]codeigniter, datamapper and ion_auth error is leaving me confused
when i call this- 当我打电话给这个
$o = new Order();
codeigniter gives me this error- codeigniter给我这个错误-
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 目前,订单模型除了执行datamapper 1.8的_template中的操作外,没有做任何其他事情
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_human(time(), TRUE, 'eu');;
$o->will_send = 1;
any guidance on why CI is trying to load the auth model to the user class? 关于CI为什么要尝试将auth模型加载到用户类的任何指导? or what am i missing here?
还是我在这里想念什么?
$this->ion_auth->order;
or $this->ion_auth_model->order;
) $this->ion_auth->order;
或$this->ion_auth_model->order;
) Did you call CI superclass in Order class? 您是否在订购类中将CI称为超类? If you trying to do access CodeIgniter's classes and functions, you have to get the CI instance inside Order class.
如果尝试访问CodeIgniter的类和函数,则必须在Order类中获取CI实例。 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... } } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.