Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container-based search transformers to allow config serialization #441

Open
tomhelmer opened this issue Oct 24, 2020 · 3 comments
Open

Comments

@tomhelmer
Copy link

Bug Description

When Laravel serializes the config closures in the config file will break the serialization.

error: Your configuration files are not serializable.

Change introduced in : statamic/cms#2462

See: laravel/framework#9625

How to Reproduce

  • Add transformer to search
  • Run php artisan optimize

Environment

Statamic 3.0.20 Pro
Laravel 7.28.4
PHP 7.4.9

@tomhelmer
Copy link
Author

A solution could be to add a searchTransformer service provider so site and addon developers can add transformers like :

app(searchTransformer::class)->extend(
  'myTransformer', 
  function ($data) { return someFunc($data); }
);

And then in search.php :

'transformers' => [
    'somefield' => 'myTransformer'
]

@github-actions
Copy link

This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.

@jasonvarga jasonvarga transferred this issue from statamic/cms Jan 19, 2021
@jasonvarga jasonvarga changed the title Transformers in search config breaks serialization Add container-based search transformers to allow config serialization Jan 19, 2021
@K3CK
Copy link

K3CK commented Mar 31, 2022

This still would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants