aimeos / aimeos-laravel

Laravel ecommerce package for ultra fast online shops, scalable marketplaces, complex B2B applications and #gigacommerce
https://aimeos.org/Laravel
MIT License
7.26k stars 1.05k forks source link

Cannot create user right after installation into existing project #473

Closed NowakAdmin closed 1 year ago

NowakAdmin commented 2 years ago

Environment

  1. Version 2022.10
  2. Operating system Linux (Debian 11)
  3. Laravel 9.37
  4. Php 8.1

Describe the bug Can't create super user account after installation. Debug in screenshoot section.

To Reproduce Steps to reproduce the behavior:

  1. install on existing laravel project by composer require aimeos/aimeos-laravel
  2. Follow installation for laravel 9
  3. Create super user by php artisan aimeos:account --super real@mail.com
  4. Type password.
  5. See error just after sending password:

Expected behavior Create user account.

Do i need to add telephone prefix inside config? My laravel is set to PL language mby this cause problem ?

Screenshots

TypeError 

  Aimeos\MShop\Common\Item\Address\Base::getTelephone(): Return value must be of type string, null returned

  at vendor/aimeos/aimeos-core/src/MShop/Common/Item/Address/Base.php:395
    391▕         * @return string Telephone number
    392▕         */
    393▕        public function getTelephone() : string
    394▕        {
  ➜ 395▕                return $this->get( $this->prefix . 'telephone', '' );
    396▕        }
    397▕
    398▕
    399▕        /**

      +19 vendor frames 
  20  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

Additional context none

NowakAdmin commented 2 years ago

After more research. Error occured becouse user real@mail.com was already exist in database. I succesfully bypass it using same method as https://github.com/aimeos/aimeos-core/commit/411d6f139950aba663022b041c3338a55c3f688e

aimeos\aimeos-core\src\MShop\Common\Item\Address\Iface.php line 275 aimeos\aimeos-core\src\MShop\Common\Item\Address\Base.php line 393

just change to ?string

I don't know it its worth commit or just adnotation in installation guide to not use existing user email.

aimeos commented 2 years ago

We cannot reproduce the problem in our local installation. Whenever we run:

php artisan aimeos:account --super aimeos@aimeos.org

it works without problems. Is the telephone column defined as non-NULL in your users table?

NowakAdmin commented 2 years ago

I checked column telephone and it's nullable, default ''

i use utf8mb4 in database, meyby this caused error ?

my migration in users is:

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->id();
        $table->string('name');
        $table->string('surname')->nullable();
        $table->string('telephone', 20)->nullable();
        $table->string('id_number', 20)->nullable();
        $table->string('country', 20)->nullable();
        $table->date('birthdate')->nullable();
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });
}
aimeos commented 2 years ago

"telephone" is also a column name used by Aimeos but has a different definition and is not nullable. You should remove it from your migration so the Aimeos column definition is used after you run php artisan aimeos:setup again.