Aimeos 2021.07 database transaction

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!
krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Aimeos 2021.07 database transaction

Post by krzysiekp » 16 Nov 2022, 17:34

How to do database transaction in Aimeos 2021.07 ? I have a code:

Code: Select all

 $orderCntl = \Aimeos\Controller\Frontend::create($this->context, 'order' );
            $basketCntl = \Aimeos\Controller\Frontend::create($this->context, 'basket' );

            $this->setAddress($req);
            $basket = $basketCntl->store();
            //begin transaction
            $orderItem = $orderCntl->add($basket->getId(), ['order.type' => 'web'])->store();
            .......
            //commit transaction
            ........
            ........
            //rollback
            
Database manager have below methods:

Code: Select all

array:6 [▼
  0 => "__construct"
  1 => "__destruct"
  2 => "__clone"
  3 => "__sleep"
  4 => "acquire"
  5 => "release"
]

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

Re: Aimeos 2021.07 database transaction

Post by aimeos » 17 Nov 2022, 17:32

Please update to 2021.10 LTS as 2021.07 and before isn't supported any more.

The controllers don't have methods for begin/commit/rollback transactions because they use them internally if required, only the managers have, e.g.:

Code: Select all

$manager = \Aimeos\MShop::create( $context, 'order' );
$manager->begin();

try {
	// ...
	$manager->commit();
} catch( \Exception $e ) {
	$manager->rollback();
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Aimeos 2021.07 database transaction

Post by krzysiekp » 18 Nov 2022, 07:57

What exact steps do I need to follow outside of composer to upgrade from 2021.07 to 2021.10?
How big are the differences between 2021.07 and 2021.10 ?

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Aimeos 2021.07 database transaction

Post by krzysiekp » 18 Nov 2022, 13:46

After composer update to 2021.10 version when I execute below command:

Code: Select all

php artisan aimeos:setup
I receive error:

Code: Select all

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'statuspayment' in 'where clause': UPDATE "mshop_order_base_product" SET "statuspayment" = -1 WHERE "statuspayment" IS NULL

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

Re: Aimeos 2021.07 database transaction

Post by aimeos » 19 Nov 2022, 08:02

Seems to be a dependency issue. Can you please execute this command and try again:

Code: Select all

composer req aimeos/aimeos-core:2021.10.x-dev
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Aimeos 2021.07 database transaction

Post by krzysiekp » 21 Nov 2022, 08:03

It's working but now I use:

Code: Select all

 "aimeos/aimeos-laravel": "2021.10.6"
and

Code: Select all

"aimeos/aimeos-core": "2021.10.x-dev"
Maybe I should update aimeos/aimeos-laravel to version 2021.10.x-dev as well ?

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

Re: Aimeos 2021.07 database transaction

Post by aimeos » 21 Nov 2022, 15:21

No, the .x-dev versions only contain non-tagged commits that will be available for all users as soon as a new version gets tagged. It's only for testing bugfixes.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Aimeos 2021.07 database transaction

Post by krzysiekp » 21 Nov 2022, 20:13

So when will the release of the new version 2021.10 with these fixes be?

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

Re: Aimeos 2021.07 database transaction

Post by aimeos » 22 Nov 2022, 14:38

New minor releases should be available tomorrow.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply