View Single Post
Old 05-02-2018, 06:43 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline

X-Cart team
Join Date: Jan 2009
Posts: 2,431

Default Re: Working with ItemsList

Hi @Alex,

First of all, do you even need this 'form_id' param in your model? Maybe you can just remove it.

Otherwise, it looks like the problem is not while creating an entity, but rather while updating it. Can it be that your ItemsList has 'form_id' in defineColumns() method, but when the request is submitted, 'form_id' is not there?


Originally Posted by Soptareanu @Alex
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();

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.
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote