Linking suppliers to products in version 2024.10

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
MaHo
Posts: 4
Joined: 24 Sep 2024, 08:03

Linking suppliers to products in version 2024.10

Post by MaHo » 28 Oct 2024, 11:22

Versions:
Laravel: v11.29.0
Aimeos: 2024.10.X
PHP: 8.3.0
OS: Ubuntu 22.04.5

I have a job controller which imports products from an API.
After upgrading to version 2024.10.1 i ran into an issue with linking the supplier to the product.

first i load the product and supplier or create them if they don't exist. After that i run the following code:

Code: Select all

	$listItem = $this->_supplierManager->createListItem();
        $listItem->setRefId($supplier->getId());

       $productItem->addListItem('supplier', $listItem, $supplier);
       
       $this->_indexManager->save($productItem);

This results in the error

Code: Select all

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'parentid' cannot be null
This error persist in version 2024.10.2

After downgrading to the previous version i used (2024.07.2) the error didn't persist.

Is there some change i missed? Or is this a bug?

User avatar
aimeos
Administrator
Posts: 8354
Joined: 01 Jan 1970, 00:00

Re: Linking suppliers to products in version 2024.10

Post by aimeos » 28 Oct 2024, 11:34

MaHo wrote: 28 Oct 2024, 11:22 first i load the product and supplier or create them if they don't exist. After that i run the following code:

Code: Select all

	$listItem = $this->_supplierManager->createListItem();
        $listItem->setRefId($supplier->getId());

       $productItem->addListItem('supplier', $listItem, $supplier);
       
       $this->_indexManager->save($productItem);
You should use the index or product manager to create the list item:

Code: Select all

	$listItem = $this->_indexManager->createListItem();
But that's not the reason for that error:
MaHo wrote: 28 Oct 2024, 11:22 This results in the error

Code: Select all

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'parentid' cannot be null
This error persist in version 2024.10.2
After downgrading to the previous version i used (2024.07.2) the error didn't persist.

Is there some change i missed? Or is this a bug?
It seems like a bug. Can you confirm that the problem still exists if you run "composer update" to get the latest 2024.10.x version of the Aimeos core package? If yes, can you post a stack trace?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

MaHo
Posts: 4
Joined: 24 Sep 2024, 08:03

Re: Linking suppliers to products in version 2024.10

Post by MaHo » 28 Oct 2024, 12:45

I have upgraded to the latest version of aimeos core 2024.10.4. This did not fix the error. However either using the product or the input manager to create the list items seems to solve this issue :D .

I have included the stack trace as an attachement because of character limits
Attachments
stacktrace.zip
(16.74 KiB) Downloaded 276 times

User avatar
aimeos
Administrator
Posts: 8354
Joined: 01 Jan 1970, 00:00

Re: Linking suppliers to products in version 2024.10

Post by aimeos » 28 Oct 2024, 12:55

If it's solved, than fine! :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply