duncanmcclean / simple-commerce

A simple, yet powerful e-commerce addon for Statamic.
https://statamic.com/addons/duncanmcclean/simple-commerce
Other
143 stars 37 forks source link

Errors after running the php please sc:switch-to-database command. #876

Closed Smoseby closed 1 year ago

Smoseby commented 1 year ago

Description

After running the php please sc:switch-to-database command to Swtich to a database, we got the following errors.

   Exception 

  The HasRunwayResource trait is missing from the [DoubleThreeDigital\SimpleCommerce\Customers\CustomerModel] model.

  at vendor/doublethreedigital/runway/src/Runway.php:27
     23▕                     $handle = $config['handle'];
     24▕                 }
     25▕ 
     26▕                 if (! in_array(Traits\HasRunwayResource::class, class_uses_recursive($model))) {
  ➜  27▕                     throw new \Exception(__('The HasRunwayResource trait is missing from the [:model] model.', ['model' => $model]));
     28▕                 }
     29▕ 
     30▕                 if (! isset($config['blueprint'])) {
     31▕                     throw new \Exception(__('The [:model] model is missing a blueprint.', ['model' => $model]));

      +12 vendor frames 

  13  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

   Exception 

  The HasRunwayResource trait is missing from the [DoubleThreeDigital\SimpleCommerce\Orders\OrderModel] model.

  at vendor/doublethreedigital/runway/src/Runway.php:27
     23▕                     $handle = $config['handle'];
     24▕                 }
     25▕ 
     26▕                 if (! in_array(Traits\HasRunwayResource::class, class_uses_recursive($model))) {
  ➜  27▕                     throw new \Exception(__('The HasRunwayResource trait is missing from the [:model] model.', ['model' => $model]));
     28▕                 }
     29▕ 
     30▕                 if (! isset($config['blueprint'])) {
     31▕                     throw new \Exception(__('The [:model] model is missing a blueprint.', ['model' => $model]));

      +12 vendor frames 

  13  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

We fixed both issues by adding the trait in the vendor package, after this we where able to continue and use simple commerce with a database.

Steps to reproduce

  1. Fresh installation of Statamic and Simple Commerce, running on laravel sail
  2. Create some products, and 1 order
  3. Decided to switch to a database, so we ran the php please sc:switch-to-database command

Environment

Environment
Application Name: Laravel
Laravel Version: 10.13.5
PHP Version: 8.2.7
Composer Version: 2.5.8
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Simple Commerce
Currencies: GBP
Gateways: Dummy
Repository: Customer: DoubleThreeDigital\SimpleCommerce\Customers\EloquentCustomerRepository
Repository: Order: DoubleThreeDigital\SimpleCommerce\Orders\EloquentOrderRepository
Repository: Product: DoubleThreeDigital\SimpleCommerce\Products\EntryProductRepository
Shipping Methods: Free Shipping
Tax Engine: DoubleThreeDigital\SimpleCommerce\Tax\Standard\TaxEngine

Statamic
Addons: 3
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.6.0 PRO

Statamic Addons
doublethreedigital/runway: 5.0.7
doublethreedigital/simple-commerce: 5.1.0
statamic/eloquent-driver: 2.1.0
duncanmcclean commented 1 year ago

Thanks for letting me know - I've opened #877 which should be released within the next couple of days.

github-actions[bot] commented 1 year ago

Released as part of v5.2.0.

Smoseby commented 1 year ago

Thanks for the quick response and update!