Page 1 of 1

Override ext/ai-laravel

Posted: 06 Oct 2017, 22:29
by bill
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

Re: Override ext/ai-laravel

Posted: 07 Oct 2017, 10:55
by aimeos
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.

Re: Override ext/ai-laravel

Posted: 07 Oct 2017, 17:44
by bill
Thanks

What about the files here

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

Re: Override ext/ai-laravel

Posted: 07 Oct 2017, 17:56
by bill
I created that file mshop.php and I changed the query but it's still not working ? Does it suppose to be mshop.php ?

Re: Override ext/ai-laravel

Posted: 08 Oct 2017, 15:53
by aimeos
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

Re: Override ext/ai-laravel

Posted: 09 Oct 2017, 15:59
by bill
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?

Re: Override ext/ai-laravel

Posted: 10 Oct 2017, 09:13
by aimeos
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" = ?
					',
				),
			),
		),
	),
);