statamic-rad-pack / runway

Eloquently manage your database models in Statamic.
https://statamic.com/addons/rad-pack/runway
MIT License
111 stars 46 forks source link

StatamicRadPack  \  Runway  \  Exceptions  \ There are no fields defined in the orders blueprint. #586

Closed deathlylol closed 3 weeks ago

deathlylol commented 3 weeks ago

Description

I use simple-commerce for my statamic app. I implemented database orders. But I get an error image

This is my runway.php

'resources' => [
        \DuncanMcClean\SimpleCommerce\Customers\CustomerModel::class => [
            'name' => 'Customers',
            'handle' => 'customers',
            'hidden' => true,
        ],

        \DuncanMcClean\SimpleCommerce\Orders\OrderModel::class => [
            'name' => 'Orders',
            'handle' => 'orders',
            'hidden' => true,
            'read_only' => true,
        ],
    ],

simple-commerce.php

 'content' => [
        'customers' => [
            'repository' => \DuncanMcClean\SimpleCommerce\Customers\EloquentCustomerRepository::class,
            'model' => \DuncanMcClean\SimpleCommerce\Customers\CustomerModel::class,
        ],

        'orders' => [
            'repository' => \DuncanMcClean\SimpleCommerce\Orders\EloquentOrderRepository::class,
            'model' => \DuncanMcClean\SimpleCommerce\Orders\OrderModel::class,
        ],

        'products' => [
            'repository' => \DuncanMcClean\SimpleCommerce\Products\EntryProductRepository::class,
            'collection' => 'products',
        ],
    ],

Steps to reproduce

I did every step from this page - https://simple-commerce.duncanmcclean.com/database-orders#content-the-model

Environment

php please support:details

Environment Application Name: Statamic Laravel Version: 11.20.0 PHP Version: 8.3.1 Composer Version: 2.7.7 Environment: local Debug Mode: ENABLED URL: bon_core.test Maintenance Mode: OFF Timezone: UTC Locale: en

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

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

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

Statamic Addons: 3 Sites: 1 Stache Watcher: Enabled (auto) Static Caching: Disabled Version: 5.22.0 Solo

Statamic Addons duncanmcclean/simple-commerce: 7.4.3 statamic-rad-pack/runway: 7.8.0 statamic/eloquent-driver: 4.12.3

Statamic Eloquent Driver Asset Containers: eloquent Assets: eloquent Blueprints: eloquent Collection Trees: eloquent Collections: eloquent Entries: eloquent Forms: eloquent Global Sets: eloquent Global Variables: eloquent Navigation Trees: eloquent Navigations: eloquent Revisions: file Sites: eloquent Taxonomies: eloquent Terms: eloquent Tokens: eloquent

duncanmcclean commented 3 weeks ago

You'll be getting that since the Order & Customer blueprints are empty.

Simple Commerce should have copied them as part of one of the commands but it obviously hasn't, so you'll need to update the blueprints manually:

deathlylol commented 2 weeks ago

@duncanmcclean is there any separate command for such cases?

duncanmcclean commented 2 weeks ago

No, you can just copy the contents of the files manually into your project.

deathlylol commented 2 weeks ago

@duncanmcclean but I have this files in my project image

duncanmcclean commented 2 weeks ago

Okay, replace the contents of the order.yaml and customer.yaml with the contents linked below:

deathlylol commented 2 weeks ago

I did it, but it didn't help me 😅

duncanmcclean commented 2 weeks ago

Oh, you're storing blueprints in the database. You'll need to copy the contents of the blueprints into the database.

Alternativley, you could export your blueprints from the database back to files, then re-import them again.

deathlylol commented 2 weeks ago

Yes! So I need to return everything to the file format, and then to the database?

duncanmcclean commented 2 weeks ago

Yeah, that's probably the easiest way.