View Single Post
  #1  
Old 05-02-2018, 03:42 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default Working with ItemsList

I have an itemsList table. I want to save in my entity a field with value of param. such as admin.php?target=returned_products&order=<Some Value of Param>. For that task I put in class that defined the table this method :
/**
* Create entity
*
* @return \XLite\Model\AEntity
*/
protected function createEntity()
{
$entity = parent::createEntity();
$entity->setFormId(\XLite\Core\Request::getInstance()->order);

return $entity;
}
But stil didn't work and throw me error :
An exception occurred while executing 'INSERT INTO xc_retur_product (position, enabled, form_id, code, qty) VALUES (?, ?, ?, ?, ?)' with params [0, 1, null, "<Value>", "<Value>"]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'form_id' cannot be null.
What method do i need in order to set this field before i persist in database ? I don't want to show in table that particular column.
__________________
Soptareanu Alex
Reply With Quote