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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/MShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ 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

$name = $config->get( 'mshop/' . $domain . '/manager/' . $subpath . 'name', 'Standard' );
}

$localClass = !empty( $parts ) ? ucwords( join( '\\', $parts ), '\\' ) . '\\' : '';
Expand Down Expand Up @@ -267,8 +266,9 @@ protected static function createManager( \Aimeos\MShop\ContextIface $context,
*/
protected static function instantiate( \Aimeos\MShop\ContextIface $context, array $parts, string $domain, string $name )
{
$mname = empty( $parts ) ? $name : $context->config()->get( 'mshop/' . $domain . '/manager/name', 'Standard' );
$classname = '\\Aimeos\\MShop\\' . ucfirst( $domain ) . '\\Manager\\' . $mname;
$iface = '\\Aimeos\\MShop\\' . ucfirst( $domain ) . '\\Manager\\Iface';
$classname = '\\Aimeos\\MShop\\' . ucfirst( $domain ) . '\\Manager\\' . $name;

$manager = self::createManager( $context, $classname, $iface, $domain );

Expand Down