Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom submanager names #297

Merged
merged 2 commits into from Sep 8, 2022
Merged

Fix custom submanager names #297

merged 2 commits into from Sep 8, 2022

Conversation

matteovg7
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Sep 1, 2022

Coverage Status

Coverage remained the same at 90.595% when pulling 251b4d7 on matteovg7:patch-2 into 6ca0345 on aimeos:master.

@@ -73,8 +73,12 @@ public static function create( \Aimeos\MShop\ContextIface $context,
if( empty( $name ) )
{
$subpath = !empty( $parts ) ? join( '/', $parts ) . '/' : '';
$name = $config->get( 'mshop/' . $domain . '/manager/' . $subpath . 'name' );
$name = $name ?: $config->get( 'mshop/' . $domain . '/manager/name', 'Standard' );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a name is passed as argument to that method, it's not used any more in your code

@aimeos
Copy link
Owner

aimeos commented Sep 1, 2022

What's the problem with the current implementations? Can you give an example when it will fail?

@matteovg7
Copy link
Contributor Author

I wrote here an example: https://aimeos.org/help/viewtopic.php?f=15&t=4690&p=18424

@aimeos
Copy link
Owner

aimeos commented Sep 8, 2022

We've shortend and improved the code a bit so it passes the tests :-)

@aimeos aimeos merged commit 58f4372 into aimeos:master Sep 8, 2022
aimeos added a commit that referenced this pull request Sep 8, 2022
Fix custom submanager names
@aimeos
Copy link
Owner

aimeos commented Sep 8, 2022

The patch has been backported to the 2022.07 branch and a new release (2022.07.6) has been tagged. Can you please confirm that this fixes the problem?

@matteovg7
Copy link
Contributor Author

Ok, now it's all ok. Thank you!

@aimeos
Copy link
Owner

aimeos commented Dec 6, 2022

The change crashed other code parts and would have led to a heavy breaking change in the stable release. In the current dev-master branch, this has been changed again to simplify configuration but until (and including 2022.10 LTS), you should be able to configure your managers in your ./config/mshop.php using:

return [
    'customer' => [
        'manager' => [
            'name' => 'Myproject',
            'address' => [
                'name' => 'Standard'
            ],
            'list' => [
                'name' => 'Myproject',
                'type' => [
                    'name' => 'Standard'
                ]
            ],
            'property' => [
                'name' => 'Myproject',
                'type' => [
                    'name' => 'Standard'
                ]
            ]
        ]
    ]
];

@matteovg7
Copy link
Contributor Author

No, it doesn't work for me.
This is my config file:

return [
    'coupon' => [
        'manager' => [
            'name' => 'CouponVG7',
            'code' => [
                'name' => 'CouponCodeVG7',
                'decorators' => [
                    'local' => ['CouponCodeCustomerId']
                ],
            ]
        ]
    ],
    'customer' => [
        'manager' => [
            'name' => 'CustomerVG7',
            'decorators' => [
                'local' => ['UsersIdPrint']
            ],
            'address' => [
                'name' => 'AddressVG7'
            ]
        ]
    ],
    'locale' => [
        'manager' => [
            'name' => 'LocaleVG7',
        ]
    ],
    'media' => [
        'manager' => [
            'name' => 'MediaVG7',
            'decorators' => [
                'local' => ['MediaIdPrint']
            ],
        ]
    ],
    'order' => [
        'manager' => [
            'name' => 'OrderVG7',
            'decorators' => [
                'local' => ['OrderIdPrint']
            ],
            'base' => [
                'name' => 'OrderBaseVG7',
                'address' => [
                    'name' => 'OrderBaseAddressVG7',
                    'decorators' => [
                        'local' => ['OrderBaseAddressAddFields']
                    ],
                ],
                'product' => [
                    'name' => 'OrderBaseProductVG7',
                    'decorators' => [
                        'local' => ['OrderBaseProductIdPrint']
                    ],
                ],
                'service' => [
                    'name' => 'OrderBaseServiceVG7'
                ],
            ]
        ]
    ],
    'product' => [
        'manager' => [
            'name' => 'ProductVG7',
            'decorators' => [
                'local' => ['ProductIdPrint', 'ProductCodePrint']
            ],
        ]
    ],
    'service' => [
        'manager' => [
            'name' => 'ServiceVG7',
            'decorators' => [
                'local' => ['ServiceIdPrint']
            ],
        ]
    ],
];

and I have this exception for example:
Class "\Aimeos\MShop\Locale\Manager\Site\LocaleVG7" not available
but I don't have extended the Aimeos\MShop\Locale\Manager\Site\Standard class in my extension.

I also tried to edit the locale array like this, but nothing change:

    'locale' => [
        'manager' => [
            'name' => 'LocaleVG7',
        ],
        'site' => [
            'name' => 'Standard',
        ]
    ],

@aimeos
Copy link
Owner

aimeos commented Dec 15, 2022

Your configuration must be:

    'locale' => [
        'manager' => [
            'name' => 'LocaleVG7',
            'currency' => [
                'name' => 'Standard',
            ],
            'language' => [
                'name' => 'Standard',
            ],
            'site' => [
                'name' => 'Standard',
            ]
        ],
    ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants