How can we create new manager for newly added table

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
unnimaya-seeroo
Posts: 10
Joined: 20 Jun 2023, 07:00

How can we create new manager for newly added table

Post by unnimaya-seeroo » 09 Dec 2023, 04:57

Aimeos : 2023.04
Windows
PHP : 8.2
Laravel 10

I have added new table in the database, how can I create the manager and include in front end controller?
I have made some changes in config/mshop/customer.php to accomadating new table, included the below in in standard.php
\Aimeos\MShop::create( $this->context(), 'customer/child_buyer' ); gives error says
Invalid component path "customer/child_buyer"
#0 /var/www/html/npkmarket/vendor/aimeos/aimeos-core/src/MShop.php(59): Aimeos\MShop::checkPath().
Please explain how to do this in right way.
@aimeos
Thanks

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

Re: How can we create new manager for newly added table

Post by aimeos » 10 Dec 2023, 11:00

How to create a sub-manager is described here:
https://aimeos.org/docs/latest/models/c ... ing-domain

You have to configure it in your ./config/mshop.php using:

Code: Select all

	'customer' => [
		'manager' => [
			'submanagers' => [
				'address' => 'address',
				'child_buyer' => 'child_buyer',
				'lists' => 'lists',
				'property' => 'property',
			]
		]
	],
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

unnimaya-seeroo
Posts: 10
Joined: 20 Jun 2023, 07:00

Re: How can we create new manager for newly added table

Post by unnimaya-seeroo » 11 Dec 2023, 07:36

Thanks for your reply.
After adding the child_buyer in the above config we got
Class "\Aimeos\MShop\Customer\Manager\Childbuyer\Laravel" not found.

As per the doc https://aimeos.org/docs/latest/models/c ... ing-domain
i have create a new file in <ext>/src/MShop/Product/Manager/ChildBuyer/Standard.php
please explain

unnimaya-seeroo
Posts: 10
Joined: 20 Jun 2023, 07:00

Re: How can we create new manager for newly added table

Post by unnimaya-seeroo » 11 Dec 2023, 09:33

Once done the composer update, it shows
Class "\Aimeos\MShop\Customer\Manager\Childbuyer\Laravel" does not implement "\Aimeos\MShop\Customer\Manager\Childbuyer\Iface"

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

Re: How can we create new manager for newly added table

Post by aimeos » 12 Dec 2023, 12:37

Store your manager in <ext>/src/MShop/Product/Manager/ChildBuyer/Laravel.php and name your class "Laravel" instead of "Standard". Your class definition should look like:

Code: Select all

namespace Aimeos\MShop\Customer\Manager\ChildBuyer;

class Laravel
	extends \Aimeos\MShop\Common\Manager\Base
	implements \Aimeos\MShop\Common\Manager\Iface
{
	// ...
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply