Jump to content

Property PrestaShopLogger->object_type is not valid


n.theologos

Recommended Posts

Hello I've created a class that extends ObjectModel the code is:

<?php
class WpiniS1BridgeLog extends ObjectModel {
	
	public $id_wpinis1bridge_log;
	public $datetime;
	public $fields;
	public $response;
	public $endpoint;
	
	/**
	 * Definition
	 *
	 */
	
	public static $definition = 
		
		array(
		
			'table' 	=> 'wpinis1bridge_log',
			'primary'	=> 'id_wpinis1bridge_log',
			'multilang'	=> false,
			'fields'	=> 
				
				array(
					'datetime' => 
						array(
							'type'		=> self::TYPE_DATE,
							'validate'	=> 'isDate',
						),
					'fields' => 
						array(
							'type'		=> self::TYPE_STRING,
							'validate'	=> 'isString'						
						),
					'response' => 
						array(
							'type'		=> self::TYPE_STRING,
							'validate'	=> 'isString'										
						),
					'endpoint' => 
						array(
							'type'		=> self::TYPE_STRING,
							'validate'	=> 'isString'										
						)
					
				)
			
		);
	
}

After this I wanted to create a page in the backend in order to display all results from db table wpinis1bridge_log

 

Code is the following:

<?php
class AdminWpiniS1BridgeController extends ModuleAdminController {
	
	public function __construct() {
		
		// Set variables		
		$this->table 		= 'wpinis1bridge_log';
		$this->className	= 'WpiniS1BridgeLog';
		
		$this->fields_list	=
			array(
				'id_wpinis1bridge_log' =>
					array(
						'title' => $this->l( 'ID' ),
						'align' => 'left',
						'width' => 25
					),
				'datetime' => 
					array(
						'title' => $this->l( 'Date' ),
						'align' => 'left'						
					),
				'fields' => 
					array(
						'title' => $this->l( 'Fields' ),
						'width'	=> 140,
						'align' => 'left'
					),		
				'response' =>
					array(
						'title' => $this->l( 'Response' ),
						'width' => 150,
						'align' => 'left'
					),
				'endpoint' => 
					array(
						'title' => $this->l( 'Endpoint' ),
						'align' => 'left'
					)
			);
			
		// Enable bootstrap
		$this->bootstrap = true;
		
		$this->addRowAction( 'view' );
		$this->addRowAction( 'delete' );
		
		$this->bulk_actions = array(
			
			'delete' => 
				array(
					'text' 		=> $this->l( 'Delete selected' ),
					'confirm'	=> $this->l( 'Would you like to delete selected items?' )
				)
			
		);
		
		parent::__construct();
			
	}
	
	public function setMedia() {
		
        parent::setMedia();
		
		$this->addCss( _MODULE_DIR_ . $this->module->name . "/views/css/jquery.jsonview.min.css" );
        $this->addJs( _MODULE_DIR_ . $this->module->name . "/views/js/jquery.jsonview.min.js" );
		
    }
	
	/**
	 * Log inner page
	 *
	 */
	public function renderView() {
		
		$tpl = $this->context->smarty->createTemplate( dirname( __FILE__ ).'/../../views/templates/admin/view.tpl' );
		$tpl->assign( 's1_log', $this->object );
		
		return $tpl->fetch();
		
	}
	
}

Everything works fine except that when I am trying to mass delete some records I am getting the following message:

 

 

Property PrestaShopLogger->object_type is not valid

 

The strange thing is that when I delete a row separately from the right column it works....

 

I've attached some screenshots as well

 

Thank you!

 

post-1248750-0-15591900-1467902064_thumb.jpg

 

post-1248750-0-20465500-1467902068_thumb.jpg

Link to comment
Share on other sites

  • 7 months later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...