Upgrade from 22.4.4 to 22.7.1

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
heural
Posts: 58
Joined: 09 Jun 2022, 07:55

Upgrade from 22.4.4 to 22.7.1

Post by heural » 07 Sep 2022, 07:43

Hi Aimeos-Team,

i have upgraded to 22.7.1 an now the typo3 scheduler breaks with the error message, even if i add a new task:
Class "\Aimeos\Controller\Jobs\Catalog\Import\Csv\Decorator\Standard" not found

I´ve created imports (products/catalog) with the decorator pattern to maintain/transform the imported data.

Code: Select all

class Mycatalogimport extends \Aimeos\Controller\Jobs\Common\Decorator\Base
{
    public function __construct(\Aimeos\Controller\Jobs\Iface $controller, \Aimeos\MShop\ContextIface $context, \Aimeos\Bootstrap $aimeos)
    {
        parent::__construct($controller, $context, $aimeos);
    }
if I rename my "Mycatalogimport" to "Standard" the class logically found but the expected construct signatur causes exception:
Argument 1 passed to Aimeos\Controller\Jobs\Catalog\Import\Csv\Decorator\Standard::__construct() must implement interface Aimeos\Controller\Jobs\Iface, instance of Aimeos\MShop\Context\Item\Typo3 given, called in C:\wamp3\aimeos\vendor\aimeos\ai-controller-jobs\src\Controller\Jobs.php on line 230
So how we must implement decorators in version 22.7?

Thank´s!

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

Re: Upgrade from 22.4.4 to 22.7.1

Post by aimeos » 08 Sep 2022, 15:07

The implementation of the job controller decorator is still correct but the way the controllers are instantiated has changed. Maybe there has been a problem introduced during that change. Can you check what happens here and why the error occurs?

https://github.com/aimeos/ai-controller ... #L115-L239
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

heural
Posts: 58
Joined: 09 Jun 2022, 07:55

Re: Upgrade from 22.4.4 to 22.7.1

Post by heural » 09 Sep 2022, 06:52

In line
https://github.com/aimeos/ai-controller ... bs.php#L49

the "incoming" path is catalog/import/csv/decorator and name is empty (coming from createControllers-method)
so the resulting classname in line 53 is \Aimeos\Controller\Jobs\Catalog\Import\Csv\Decorator\Standard that does not exist.

If i change Mydecorator to "Standard.php" the error occures later, in line https://github.com/aimeos/ai-controller ... s.php#L230

I think the instanciate of decorators has "moved" into the instanciation of job controllers,
the createControllers-method iterates the directory, maybe it have to exclude "/Decorator"-subdirs?

If I add

Code: Select all

&& $entry->getBaseName() !== 'Decorator' "
in Line https://github.com/aimeos/ai-controller ... s.php#L259 it seems to work.

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

Re: Upgrade from 22.4.4 to 22.7.1

Post by aimeos » 09 Sep 2022, 06:57

heural wrote: 09 Sep 2022, 06:52 https://github.com/aimeos/ai-controller ... bs.php#L49

the "incoming" path is catalog/import/csv/decorator and name is empty (coming from createControllers-method)
so the resulting classname in line 53 is \Aimeos\Controller\Jobs\Catalog\Import\Csv\Decorator\Standard that does not exist.
This shouldn't be the case, "catalog/import/csv" would be correct as $path parameter. Where does the ".../decorator" part comes from?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

heural
Posts: 58
Joined: 09 Jun 2022, 07:55

Re: Upgrade from 22.4.4 to 22.7.1

Post by heural » 09 Sep 2022, 08:21

The decorator-dir comes from my extension (docu https://aimeos.org/docs/latest/config/c ... atorslocal), and it will retrieved in
https://github.com/aimeos/ai-controller ... #L259-L267

But there is a decorator-class, not a job controller. So if i change the line 259 to

Code: Select all

if( $entry->getType() === 'dir' && $entry->isDot() === false && $entry->getBaseName() !== 'Common' && $entry->getBaseName() !== 'Decorator')
the decorator-dir will be excluded.

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

Re: Upgrade from 22.4.4 to 22.7.1

Post by aimeos » 09 Sep 2022, 08:42

Thank you for your help to solve that issue!

We've change the condition according to your suggestion now:
https://github.com/aimeos/ai-controller ... 26c6682f56

The fix is in dev-master and 2022.07.x-dev. Can you confirm that it works now?
Afterwards, we can tag a new version.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

heural
Posts: 58
Joined: 09 Jun 2022, 07:55

Re: Upgrade from 22.4.4 to 22.7.1

Post by heural » 09 Sep 2022, 09:34

Works as expected, thank you.

Post Reply