Closed joshtaylordev closed 1 month ago
The serialisation of closure is because youre trying to cache your config - if you use the class based transformer this wont happen.
Can you share your blueprint and collection config - this seems pretty odd - I'm surprised to see any difference in the drivers for this sort of issue.
I'm a little confused the environment file I shared says Config: NOT CACHED
unless I'm missing something?
Below is the collection and blueprint configs for Articles and Article Categories. The Collections are using the eloquent driver and the Blueprints are using flat file.
Article blueprint config:
tabs:
main:
display: Main
sections:
-
fields:
-
handle: title
field:
type: text
required: true
validate:
- required
-
handle: excerpt
field:
type: textarea
display: Excerpt
-
display: Content
fields:
-
handle: content
field:
remove_empty_nodes: false
type: bard
display: Content
buttons:
- h3
- h4
- h5
- h6
- small
- bold
- underline
- italic
- strikethrough
- color
- unorderedlist
- orderedlist
- removeformat
- quote
- anchor
- image
- table
sidebar:
display: Sidebar
sections:
-
fields:
-
handle: slug
field:
type: slug
localizable: true
validate: 'max:200'
-
handle: date
field:
type: date
required: true
default: now
validate:
- required
display: 'Publish Date'
-
handle: article_categories
field:
taxonomies:
- article_categories
type: terms
display: Category
title: Article
Article collection config (exported into flat file, this will need to be imported into a DB):
title: Articles
template: articles/show
layout: layout
mount: 20f4966b-dfb6-4fb3-8a9a-ea2a6c897444
taxonomies:
- article_categories
revisions: false
route: '/{mount}/{slug}'
date: true
sort_dir: asc
date_behavior:
past: public
future: private
preview_targets:
-
label: Entry
url: '{permalink}'
refresh: true
Article category blueprint config:
tabs:
main:
display: Main
sections:
-
fields:
-
handle: title
field:
type: text
required: true
validate:
- required
-
handle: content
field:
type: markdown
localizable: true
sidebar:
display: Sidebar
sections:
-
fields:
-
handle: slug
field:
type: slug
required: true
validate:
- required
- 'max:200'
title: 'Article Category'
Article category collection config (exported into flat file, this will need to be imported into a DB):
title: 'Article Categories'
preview_targets:
-
label: Term
url: '{permalink}'
refresh: true
layout: layout
Let me know if you need anything else
Unfortunately I'm not seeing what you are seeing, as no matter whether I use eloquent or file driven I only get an array of handles, not actual terms. Are you able to pull together a repository showing the issue?
Hi Ryan,
I think I must have been missing the search parameter in the url when I switched back to flat file or something, as I can't seem to replicate the issue at all now. Sorry for wasting your time on that one!
I'm still not quite sure what is happening with the Serialization of 'Closure' is not allowed
error when trying to transform the search data as my config shouldn't be cached. But I'm happy to close this issue off, as we've found a work around for now
Thanks
Bug description
When using the search tag with Eloquent Driver, the results return the taxonomy term field as a raw array of slugs. E.g.
Whereas when using flat file it returns an Augmented Array so you can access title, url e.g.
How to reproduce
Create an entry and add a category with the Taxonomy Terms Field. Create a search form or just add the search param to the url e.g.
?q=test
Use the search tag to output the resultsLogs
No response
Environment
Additional details
I tried to get around the issue by transforming the data following the example from Statamic docs. However, just adding the title example from the docs causes the page to error with:
Serialization of 'Closure' is not allowed
. It's probably a separate issue but thought I should mention it here