n.theologos Posted July 7, 2016 Share Posted July 7, 2016 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! Link to comment Share on other sites More sharing options...
n.theologos Posted July 8, 2016 Author Share Posted July 8, 2016 Anyone? Link to comment Share on other sites More sharing options...
rocky Posted February 13, 2017 Share Posted February 13, 2017 It seems numbers aren't allowed in class names, since Validate::isName() is being called on the PrestashopLogger->object_type field. If you remove the 1 from your class name, it should work. Link to comment Share on other sites More sharing options...
Klemart3D Posted February 18, 2019 Share Posted February 18, 2019 I confirm, the error "La propriété PrestaShopLogger->object_type n'est pas valide." is due to the number into Model class name. I delete it and its works now, thanks @rocky ! Strange error because numbers are allowed into controller class name and works fine... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now