Excludes Decorators doesn't work

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!
User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Excludes Decorators doesn't work

Post by peter69 » 10 Nov 2022, 22:58

Hello everyone,

I want to exclude some decorators from the service module, I have tried several configurations in my custom theme but none of them work:

admin.php:

Code: Select all

<?php

return [
	'jqadm' => [
            'service' => [
            	'decorators' => [
                	'excludes' => [
	                    'Country',
        	            'Download'
                	]
	            ]
             ]
	],
	'jsonadm' => [
	],
];
controller.php:

Code: Select all

'frontend' => [
        'catalog' => [
            'levels-always' => 3 // number of category levels for mega menu
        ],
        'service' => [
            'decorators' => [
                'excludes' => [
                    'Country',
                    'Download'
                ]
            ]
        ]
],
mshop.php:

Code: Select all

<?php

return [
    'service' => [
        'manager' => [
            'decorators' => [
                'excludes' => [
                    'Country',
                    'Download'
                ]
            ],
            'lists' => [
                'decorators' => [
                    'excludes' => [
                        'Country',
                        'Download'
                    ]
                ]
            ]
        ],
    ]
];

These two decorators are still on display in the Service module. none of the configurations I listed above work.

I even cleared all the cache and it still does not work.

I would appreciate your help,

Regards!

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

Re: Excludes Decorators doesn't work

Post by aimeos » 11 Nov 2022, 06:17

Excluding manager decorators for certain domains only work if you've configured them for all domains before.
The service decorators can't be removed from the list in the service panel because they are discovered automatically due to their file system location.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Excludes Decorators doesn't work

Post by peter69 » 11 Nov 2022, 14:58

Oh ok! Now I understand about the service decorators, thanks!

I'm still not clear about "manager decorators for certain domains". I have read the documentation several times but I still don't understand exactly the functionality.

If possible, could you share an example of this?

Again, thank you very much for your help!

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

Re: Excludes Decorators doesn't work

Post by aimeos » 12 Nov 2022, 05:26

You can configure a manager decorator globally for all domains (product, catalog, order, etc.):

Code: Select all

return [
    'common' => [
        'manager' => [
            'decorators' => [
                'global' => ['Myproject']
            ]
        ]
    ]
];
There may be some domains where this decorator should not be applied to. Instead of configuring all domains the decorator should be applied to, you can now tell Aimeos to exclude certain domains:

Code: Select all

return [
    'locale' => [
        'manager' => [
            'site' => [
                'decorators' => [
                     'exclude' => ['Myproject']
                ]
            ]
        ]
    ],
    'order' => [
        'manager' => [
            'decorators' => [
                'exclude' => ['Myproject']
            ]
        ]
    ]
];
Also, you can implement decorators for certain domains only, e.g. for the catalog domains which manages a tree and has methods like getPath(), getTree(), move() etc. which are not available in all other domains. These are local decorators which can't be applied to other domains due to their namespace:

Code: Select all

return [
    'catalog' => [
        'manager' => [
            'decorators' => [
                'local' => ['Mytreedecorator']
            ]
        ]
    ]
];
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
peter69
Posts: 95
Joined: 09 Jun 2022, 19:31

Re: Excludes Decorators doesn't work

Post by peter69 » 12 Nov 2022, 05:55

Thank you very much!!!

Now I understand the functionality of the decorators. Just yesterday I implemented 2 decorators and it has been amazing.

I don't know if they exist in other projects, but the decorators seem to me an excellent idea. They are really very useful. congratulations!

Again, thank you very much for taking the time to answer and clarify our doubts.

Best regards!

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

Re: Excludes Decorators doesn't work

Post by aimeos » 12 Nov 2022, 18:45

PSR-7 and Laravel middlewares are in fact decorators too
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply