Add column in mshop_customer (Issue)

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!
raghibkhesal2001

Add column in mshop_customer (Issue)

Post by raghibkhesal2001 » 19 Aug 2020, 14:39

Hi,
I added following code on my custom extension ./ext/myext/lib/custom/setup/default/schema/customer.php

Code: Select all

<?php
//https://aimeos.org/docs/Developers/Library/Extend_managers_items


return array(
  'table' => array(
    'mshop_customer' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
 
        $table = $schema->getTable( 'mshop_customer' );
        $table->addColumn(  'vendor_name', 'string', array( 'length' => 32, 'notnull' => false ) ); 
        return $schema;
    },
  ),
);

and added following code in ./ext/myext/lib/custom/src/MShop/Customer/Manager/Decorator/Myproject.php
namespace Aimeos\MShop\Customer\Manager\Decorator;

Code: Select all

class Myproject extends \Aimeos\MShop\Common\Manager\Decorator\Base
{
    private $attr = [
        'vendor_name' => [
            'code' => 'vendor_name',
            'internalcode' => 'mcus."vendor_name"',
            'label' => 'My new column',
            'type' => 'string',
            'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
        ],
    ];
 
    public function getSaveAttributes()
    {
        return parent::getSaveAttributes() + $this->createAttributes( $this->attr );
    }
 
    public function getSearchAttributes( $sub = true )
    {
        return parent::getSearchAttributes( $sub ) + $this->createAttributes( $this->attr );
    }
}
and added ./ext/myext/config/mshop.php

Code: Select all

return [
    'customer' => [
        'manager' => [
            'decorators' => [
                'local' => ['Myproject']
            ],
        ],
    ],
];
after that i run php artisan serve. But column not created.

am i missing something? please provide me step.

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

Re: Add column in mshop_customer (Issue)

Post by aimeos » 19 Aug 2020, 20:43

Code: Select all

./artisan serve
only starts the web server. You need to run

Code: Select all

./artisan aimeos:setup
first.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

raghibkhesal2001

Re: Add column in mshop_customer (Issue)

Post by raghibkhesal2001 » 20 Aug 2020, 07:59

Thanks and when i tried to php artisan aimeos:setup then i got "Aimeos\MW\Setup\Exception : No databases configured in resource config file"

I checked and found that i set database configuration on the .env file but i missed to add database configuration on the config.shop -> resource -> db.

After setup, artisan aimeos:setup work successfully and created column.

Thanks for the help.

Post Reply