Error Call to a member function info() on a non-object Base_module_model.php on line 1502

edited June 2017 in Bug Reports
I m using fuel version FUEL 1.4 uses CodeIgniter 3.x have created an model in

fuel\application\models - folder with following db structure
CREATE TABLE `banners` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`image` varchar(255) NOT NULL,
`upper_text` text NOT NULL,
`link` text NOT NULL,
`bottom_text` text NOT NULL,
`sequence` int(11) NOT NULL,
`inactiv` tinyint(1) NOT NULL DEFAULT '0',
`date_added` datetime NOT NULL,
`date_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
Class is as follow :

require_once(FUEL_PATH.'models/base_module_model.php');
class Home_page_banners extends Base_module_model{
public $boolean_fields = array('inactiv');
public $serialized_fields = array('sequence');
public function __construct()
{
parent::__construct('banners'); // table name
}
public function form_fields($values = array(), $related = array())
{
$fields = parent::form_fields($values, $related);
$fields['link']['type']='url';
if(isset($fields['date_modified'])){unset($fields['date_modified']);}
$fields['image']['is_image']=TRUE;
$fields['image']['width']=1920;
$fields['image']['height']=600;
$fields['image']['maintain_ratio']=TRUE;
$fields['image']['resize_and_crop']=TRUE;
$fields['image']['resize_method']='resize_and_crop';
$fields['image']['overwrite']=FALSE;
$fields['image']['display_overwrite']=FALSE;
$fields['image']['upload_path']='images/banners';
$fields['image']['encrypt_name']=TRUE;
$fields['image']['display_preview']=TRUE;
$fields['image']['remove_spaces']=TRUE;
$fields['image']['multiple']=FALSE;

//print_r($fields);
return $fields;
}
public function on_before_save($values)
{
$values = parent::on_before_save($values);
//print_r($values);
return $values;
}
//put your code here
}
issue : while i am going to save it is giving an error as follow :

Fatal error: Call to a member function info() on a non-object in
C:\xampp\htdocs\propel\fuel\modules\fuel\models\Base_module_model.php on line 1502

A PHP Error was encountered

Severity: Error

Message: Call to a member function info() on a non-object

Filename: models/Base_module_model.php

Line Number: 1502

Backtrace:
while the image got uploaded to images folder instead of images/banners

please help me out on it

stackoverflow link : https://stackoverflow.com/questions/44305926/fuel-cms-simple-module-issue-call-to-a-member-function-info-on-a-non-object-ba

Comments

  • edited June 2017
    Have you set it up as a simple module yet in the fuel/application/config/MY_fuel_modules.php?
    http://docs.getfuelcms.com/modules/simple
  • edited June 2017
    hi
    actually every thing was current as per the requirement . but what i have done wrong was the name of the module .
    after removing "_page" from the name it is working fine ...

    it was not working because the name of the class got through get_class() function as "Home__banners" removing the key word 'page'
Sign In or Register to comment.