Override ext/ai-laravel

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!
bill
Posts: 51
Joined: 24 Apr 2017, 17:51

Override ext/ai-laravel

Post by bill » 06 Oct 2017, 22:29

Hi

I am trying to override this file here >> ext/ai-laravel/lib/custom/config/mshop/customer.php

is that possible I want to add it to my own ext folder

please help

Thanks

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

Re: Override ext/ai-laravel

Post by aimeos » 07 Oct 2017, 10:55

Yes, create a file "mshop.php" in the "./lib/custom/config/" directory of your extension with the same array structure and add the SQL statements you want to overwrite.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

bill
Posts: 51
Joined: 24 Apr 2017, 17:51

Re: Override ext/ai-laravel

Post by bill » 07 Oct 2017, 17:44

Thanks

What about the files here

Ext/ai-Laravel/lib/src/Mshop/Customer/Manager/Laravel.php. Can I over ride these ??

bill
Posts: 51
Joined: 24 Apr 2017, 17:51

Re: Override ext/ai-laravel

Post by bill » 07 Oct 2017, 17:56

I created that file mshop.php and I changed the query but it's still not working ? Does it suppose to be mshop.php ?

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

Re: Override ext/ai-laravel

Post by aimeos » 08 Oct 2017, 15:53

You can overwrite the manager class to. Create a new class in your extension in the

./lib/custom/src/MShop/Customer/Manager/Myproject.php

extend from

\Aimeos\MShop\Customer\Manager\Laravel

and overwrite the methods you need. Afterwards, configure your shop to use your new class with
https://aimeos.org/docs/Configuration/C ... nager/name
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

bill
Posts: 51
Joined: 24 Apr 2017, 17:51

Re: Override ext/ai-laravel

Post by bill » 09 Oct 2017, 15:59

what about this

I created that file mshop.php and I changed the query but it's still not working ? Does it suppose to be mshop.php ?

its still doesnt work.

I am trying to do the command line :

php artisan aimeos:account test@email.com --admin

and I am getting an error coming from ext/ai-laravel/custom/config/mshop/customer.php , ( I dont want to edit this file here to fix the error) I need to override it

so I override it in my ext/mydir/lib/custom/config/mshop.php but its not picking up that one?

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

Re: Override ext/ai-laravel

Post by aimeos » 10 Oct 2017, 09:13

To enforce the correct order, please add "ai-laravel" to the "depends" section in the manifest.php of your project specific extension:

Code: Select all

	'depends' => array(
		'aimeos-core',
		'ai-admin-extadm',
		'ai-admin-jqadm',
		'ai-admin-jsonadm',
		'ai-client-html',
		'ai-client-jsonapi',
		'ai-controller-jobs',
		'ai-laravel',
	),
Here's an example file for your "./ext/mydir/lib/custom/config/mshop.php":

Code: Select all

<?php
return array(
	'customer' => array(
		'manager' => array(
			'laravel' => array(
				'insert' => array(
					'ansi' => '
						INSERT INTO "users" (
							"siteid", "name", "company", "vatid", "salutation", "title",
							"firstname", "lastname", "address1", "address2", "address3",
							"postal", "city", "state", "countryid", "langid", "telephone",
							"telefax", "website", "email", "longitude", "latitude", "label",
							"birthday", "status", "vdate", "password",
							"updated_at", "editor", "created_at"
						) VALUES (
							?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
						)
					',
				),
				'update' => array(
					'ansi' => '
						UPDATE "users"
						SET "siteid" = ?, "name" = ?, "company" = ?, "vatid" = ?,
							"salutation" = ?, "title" = ?, "firstname" = ?, "lastname" = ?,
							"address1" = ?, "address2" = ?, "address3" = ?, "postal" = ?,
							"city" = ?, "state" = ?, "countryid" = ?, "langid" = ?,
							"telephone" = ?, "telefax" = ?, "website" = ?, "email" = ?,
							"longitude" = ?, "latitude" = ?, "label" = ?, "birthday" = ?,
							"status" = ?, "vdate" = ?, "password" = ?, "updated_at" = ?, "editor" = ?
						WHERE "id" = ?
					',
				),
			),
		),
	),
);
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply