Modify users table
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Re: Modify users table
The mshop_customer and mshop_customer_list are empty but i don't understand why i've a constraint violation !
Please help !
Please help !
Re: Modify users table
You've probably extended from the Standard class, not from the Laravel class. The Standard class refers in its lists and property sub-manager to the mshop_customer_* tables instead of the users_* tables.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Modify users table
Hi ! when i execute artisan aimeos:setup , there's not any error but in the database some columns have wrong data ( for example i've not any data in the 'email' column , the columns 'company' and 'website' have the email and some others columns are wrong )
Re: Modify users table
The bind() calls in our saveItem() method doesn't correspond to your SQL statement in your config
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Modify users table
Starting with the upcoming 2019.10 release, managing custom columns will be super easy.
Extend the table (like already available) in ./ext/<your_extension>/lib/custom/setup/default/schema/customer.php:
Extend the customer manager by the 'mycolumn' column in ./ext/<your_extension>/lib/custom/src/MShop/Customer/Manager/Decorator/Myproject.php:
Configure the new decorator in ./config/shop.php (mshop section):
Aimeos cares about storing and retrieving the data automatically without any further code. Now you can do:
Extend the table (like already available) in ./ext/<your_extension>/lib/custom/setup/default/schema/customer.php:
Code: Select all
return array(
'table' => array(
'users' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {
$table = $schema->getTable( 'users' );
$table->addColumn( 'mycolumn', 'string', array( 'length' => 64 ) );
return $schema;
},
);
Code: Select all
namespace Aimeos\MShop\Customer\Manager\Decorator;
class Myproject
extends \Aimeos\MShop\Common\Manager\Decorator\Base
{
private $attr = [
'mycolumn' => [
'code' => 'mycolumn',
'internalcode' => 'mcus."mycolumn"',
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
]
];
public function getSaveAttributes()
{
return parent::getSaveAttributes() + $this->createAttributes( $this->attr );
}
public function getSearchAttributes( $withsub = true )
{
return parent::getSearchAttributes( $withsub ) + $this->createAttributes( $this->attr );
}
}
Code: Select all
'mshop' => [
'customer' => [
'manager' => [
'decorator' => [
'local' => ['Myproject']
]
]
]
]
Code: Select all
$manager = \Aimeos\MShop::create( $context, 'customer' );
$item = $manager->createItem()->set( 'mycolumn', 'myvalue' );
$item = $manager->saveItem( $item );
$search = $manager->createSearch();
$search->setConditions( $search->compare( '==', 'mycolumn', 'myvalue' ) );
foreach( $manager->searchItems( $search ) as $item ) {
echo $item->get( 'mycolumn', 'default value' );
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star