statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
104 stars 71 forks source link

Parent and URI not populating when creating a Child entry with Eloquent 4.0 / Statamic 5 #284

Closed dkolarov closed 1 month ago

dkolarov commented 1 month ago

Trying to create a child entry in eloquent set up (Statamic5, Eloquent 4.0), by setting the URI and the parent id of new entry as shown in code below, but they will remain unchanged. The Entry points to Home, instead of the parent and the URI remains null after saving the entry. Slug and all other fields are updated properly.

$entry = Entry::make()->collection('pages')->slug($slug_article); $entry->site('default'); $entry->blueprint('pages'); $entry->date(Carbon::parse('now')); $entry->published(true); $entry->status('published'); $entry->locale('default'); $entry->set("uri", "/".$parent->slug."/".$slug_article); $entry->data([ parent' => $parent->id, ... ]); $entry->save();

ryanmitchell commented 1 month ago

The parent field isn't the right approach to creating a child, you need to add it to the tree. Something like:

$collection = Collection::findByHandle('handle');
$collectionStructure = $collection->structure()->in('default');

// make a new entry
$entry = Entry::make()
    ->collection('handle')
    ->locale('default')
    ->slug($termSlug)
    ->published(true)
    ->data([...]);

// parent of entry
$entryParent = Entry::newQuery()->where('x', 'y');

// after save, update tree
$entry->afterSave(function ($entry) use ($entryParent, $collectionStructure) {
    $collectionStructure->syncOriginal(); // this seems to be necessary or you end up with an error about flip() when creating multiple entries in the same request
    if (!$entryParent) {
        $collectionStructure->append($entry);
    } else {
        $collectionStructure->appendTo($entryParent->id(), $entry->id());
    }
    $collectionStructure->save();
});
dkolarov commented 1 month ago

Thank you - I will try that.

-- Kind Regards, Dian Kolarov Increate Ltd T: 02037720000 | 07971921142 @.***

On 10/05/2024 12:40, Ryan Mitchell wrote:

The parent field isn't the right approach to creating a child, you need to add it to the tree. Something like:

$collection =Collection::findByHandle('handle'); $collectionStructure =$collection->structure()->in('default');

// make a new entry $entry =Entry::make() ->collection('handle') ->locale('default') ->slug($termSlug) ->published(true) ->data([...]);

// parent of entry $entryParent =Entry::newQuery()->where('x','y');

// after save, update tree $entry->afterSave(function ($entry)use ($entryParent,$collectionStructure) { $collectionStructure->syncOriginal();// this seems to be necessary or you end up with an error about flip() when creating multiple entries in the same request if (!$entryParent) { $collectionStructure->append($entry); }else { $collectionStructure->appendTo($entryParent->id(),$entry->id()); } $collectionStructure->save(); });

— Reply to this email directly, view it on GitHub https://github.com/statamic/eloquent-driver/issues/284#issuecomment-2104459269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6SWHSXBK4MJE5JVAXJYFLZBSWZHAVCNFSM6AAAAABHQO2WE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUGQ2TSMRWHE. You are receiving this because you authored the thread.Message ID: @.***>

dkolarov commented 1 month ago

Hi Ryan,

This all worked fine, but I am getting the error below on CollectionStructure->save() and I get the same error in the Control Panel as well, if I make a change to the order of entries or try to delete one.

I have upgraded to Statamic 5 / Eloquent 4 yesterday and did not had this issue before, but I also wonder if deleting entries directly form the database (while running tests) can cause something like this? Can't really think of another reason.

-- Kind Regards, Dian Kolarov Increate Ltd T: 02037720000 | 07971921142 @.***

On 10/05/2024 12:40, Ryan Mitchell wrote:

The parent field isn't the right approach to creating a child, you need to add it to the tree. Something like:

$collection =Collection::findByHandle('handle'); $collectionStructure =$collection->structure()->in('default');

// make a new entry $entry =Entry::make() ->collection('handle') ->locale('default') ->slug($termSlug) ->published(true) ->data([...]);

// parent of entry $entryParent =Entry::newQuery()->where('x','y');

// after save, update tree $entry->afterSave(function ($entry)use ($entryParent,$collectionStructure) { $collectionStructure->syncOriginal();// this seems to be necessary or you end up with an error about flip() when creating multiple entries in the same request if (!$entryParent) { $collectionStructure->append($entry); }else { $collectionStructure->appendTo($entryParent->id(),$entry->id()); } $collectionStructure->save(); });

— Reply to this email directly, view it on GitHub https://github.com/statamic/eloquent-driver/issues/284#issuecomment-2104459269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6SWHSXBK4MJE5JVAXJYFLZBSWZHAVCNFSM6AAAAABHQO2WE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUGQ2TSMRWHE. You are receiving this because you authored the thread.Message ID: @.***>

ryanmitchell commented 1 month ago

What error? Can you also post the result of ‘php please support:details’

dkolarov commented 1 month ago

Hi,

It looks like the screenshot did not go through - the error is "Undefined array key 1 and I am providing screenshot on url (https://cdn.frontserve.net/screenshot.png) and there is the error  log entry below...

Support output below...

Environment Application Name: woodfloorsanding.co.uk Laravel Version: 10.48.10 PHP Version: 8.2.18 Composer Version: 2.7.2 Environment: local Debug Mode: ENABLED URL: woodfloorsanding.local Maintenance Mode: OFF

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

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

Statamic Addons: 3 Sites: 1 Stache Watcher: Disabled Static Caching: Disabled Version: 5.0.1 PRO

Statamic Addons jacksleight/statamic-bard-texstyle: 3.2.1 statamic/eloquent-driver: 4.0.0 statamic/seo-pro: 6.0.0

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: eloquent Taxonomies: eloquent Terms: eloquent

ryanmitchell commented 1 month ago

Github doesn't allow markdown in email replies, so the stack trace is:

Undefined array key 1 {"userId":"61db35c3-712f-4140-91d2-c505e8382626","exception":"[object] (ErrorException(code: 0): Undefined array key 1 at /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Stores/CollectionEntriesStore.php:42)
[stacktrace]
#0 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Stores/CollectionEntriesStore.php(42): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 [internal function]: Statamic\\Stache\\Stores\\CollectionEntriesStore->getItemFilter()
#3 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(911): array_filter()
#4 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(387): Illuminate\\Support\\Arr::where()
#5 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Traverser.php(33): Illuminate\\Support\\Collection->filter()
#6 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Stores/Store.php(298): Statamic\\Stache\\Traverser->traverse()
#7 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Stores/Store.php(73): Statamic\\Stache\\Stores\\Store->paths()
#8 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Indexes/Value.php(11): Statamic\\Stache\\Stores\\Store->getItemsFromFiles()
#9 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Indexes/Index.php(95): Statamic\\Stache\\Indexes\\Value->getItems()
#10 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Indexes/Index.php(79): Statamic\\Stache\\Indexes\\Index->update()
#11 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Stores/Store.php(47): Statamic\\Stache\\Indexes\\Index->load()
#12 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Stores/CollectionsStore.php(116): Statamic\\Stache\\Stores\\Store->index()
#13 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Stache/Repositories/CollectionRepository.php(111): Statamic\\Stache\\Stores\\CollectionsStore->updateEntryParent()
#14 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Statamic\\Stache\\Repositories\\CollectionRepository->updateEntryParent()
#15 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Entries/Collection.php(520): Illuminate\\Support\\Facades\\Facade::__callStatic()
#16 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Entries/UpdateStructuredEntryOrderAndParent.php(22): Statamic\\Entries\\Collection->updateEntryParent()
#17 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(478): Statamic\\Entries\\UpdateStructuredEntryOrderAndParent->handle()
#18 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(286): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}()
#19 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(266): Illuminate\\Events\\Dispatcher->invokeListeners()
#20 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(433): Illuminate\\Events\\Dispatcher->dispatch()
#21 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Events/Event.php(21): event()
#22 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Structures/CollectionTree.php(45): Statamic\\Events\\Event::dispatch()
#23 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Structures/Tree.php(166): Statamic\\Structures\\CollectionTree->dispatchSavedEvent()
#24 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Controllers/CP/Collections/CollectionTreeController.php(49): Statamic\\Structures\\Tree->save()
#25 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Statamic\\Http\\Controllers\\CP\\Collections\\CollectionTreeController->update()
#26 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
#27 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#28 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#29 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#30 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#31 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/DeleteTemporaryFileUploads.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\DeleteTemporaryFileUploads->handle()
#33 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/AddVaryHeaderToResponse.php(11): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\AddVaryHeaderToResponse->handle()
#35 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/CountUsers.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\CountUsers->handle()
#37 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/BootUtilities.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\BootUtilities->handle()
#39 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/BootPreferences.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\BootPreferences->handle()
#41 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/BootPermissions.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\BootPermissions->handle()
#43 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/SelectedSite.php(15): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\SelectedSite->handle()
#45 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/Localize.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\Localize->handle()
#47 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/Authorize.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#48 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\Authorize->handle()
#49 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#50 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#51 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/AddToasts.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#52 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\AddToasts->handle()
#53 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/AuthGuard.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#54 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\AuthGuard->handle()
#55 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CP/ContactOutpost.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#56 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CP\\ContactOutpost->handle()
#57 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#58 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#59 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#60 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#61 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#62 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#63 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#64 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#65 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle()
#66 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#67 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#68 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#69 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#70 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/SwapExceptionHandler.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#71 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\SwapExceptionHandler->handle()
#72 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#73 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#74 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#75 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#76 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#77 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#78 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#79 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/StopImpersonating.php(12): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#80 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\StopImpersonating->handle()
#81 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/DisableFloc.php(17): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#82 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\DisableFloc->handle()
#83 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CheckMultisite.php(15): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#84 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CheckMultisite->handle()
#85 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/CheckComposerJsonScripts.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#86 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CheckComposerJsonScripts->handle()
#87 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/statamic/cms/src/Http/Middleware/PoweredByHeader.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#88 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\PoweredByHeader->handle()
#89 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#90 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#91 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#92 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#93 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#94 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(36): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#95 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#96 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#97 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#98 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#99 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#100 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#101 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#102 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#103 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#104 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#105 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#106 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#107 /home/virtualhosts/woodfloorsanding.co.uk.local/dev/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#108 {main}
"}
ryanmitchell commented 1 month ago

The error is strange as it's hitting the stache repositories for collections and trees, when your config is showing you using eloquent. I'll see if I can get some time on this early next week, if no one else beats me to it.

dkolarov commented 1 month ago

Hi Ryan,

You were right - I fixed the issue by replacing the "Home page" in the collection with a new one and clearing all cache. Not sure how this relates, but I did start from file based set up and later moved to eloquent and I did stache:clear and static:clear before reporting this.

Not sure if this was a one-off or needs further investigation, but your reply hinted a direction - thanks!

-- Kind Regards, Dian Kolarov Increate Ltd T: 02037720000 | 07971921142 @.***

On 10/05/2024 16:33, Ryan Mitchell wrote:

The error is strange as it's hitting the stache repositories for collections and trees, when your config is showing you using eloquent. I'll see if I can get some time on this early next week, if no one else beats me to it.

— Reply to this email directly, view it on GitHub https://github.com/statamic/eloquent-driver/issues/284#issuecomment-2104814883, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6SWHS2WOLYIRT6KQ42UK3ZBTSEFAVCNFSM6AAAAABHQO2WE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUHAYTIOBYGM. You are receiving this because you authored the thread.Message ID: @.***>

ryanmitchell commented 1 month ago

Ah brilliant. Thanks for the update.