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

Project config switching between true/false and '1'/'0' on rebuild #4094

Closed
juresrpcic opened this issue Apr 3, 2019 · 4 comments
Closed
Assignees
Labels
enhancement improvements to existing features project config 🐫 features related to Project config

Comments

@juresrpcic
Copy link

Description

When building fields in the CP, statements in project config yaml look like this:
required: false
sortOrder: 1
etc.

When running a rebuild later (which should just leave the yaml alone), it always replaces original values with these:
required: '0'
sortOrder: '1'
etc.

This can even be seen on an empty install when using the project config as a quick start - the values switch on initial install the same way.

I'm running the config sync locally on a Windows dev environment (WinNmp - nginx, php 7.3, mysql 5.7).

This doesn't affect functionality afaik, but it makes the Git commits hard to review for actual project config changes.

Steps to reproduce

  1. Add some fields via CP
  2. Run ./craft project-config/rebuild
  3. Commit project config to Git and look at changes

Additional info

  • Craft version: Craft Pro 3.1.20.1
  • PHP version: 7.3.2
  • Database driver & version: MySQL 5.7.21
  • Plugins & versions: /
@jamesmacwhite
Copy link
Contributor

I had a somewhat similar question and @brandonkelly provided a bit of insight into why it's happening.

#4042

I hope it explains the situation a bit.

@juresrpcic
Copy link
Author

Thanks @jamesmacwhite , that helps. I guess I'll make sure to run a project config rebuild before every commit then as that seems to normalize everything to MySQL string values - so I can keep the useful Git commit comparisons.

For anyone else reading this - if you're developing and don't care for keeping soft deleted items, it's better to run garbage collection before rebuilding the config (or deleted sections will find themselves back in the yaml file). This issue should get resolved soon though - #4100

So I'll run this before each commit:

./craft gc/run
./craft project-config/rebuild

@brandonkelly
Copy link
Member

We’re going to see if we can go through all the config array definitions and start typecasting the values from there, e.g.

$config = [
    'foo' => (bool)$model->foo,
];

So values are always consistently saved with the correct types.

@brandonkelly brandonkelly added project config 🐫 features related to Project config enhancement improvements to existing features labels Apr 5, 2019
@andris-sevcenko
Copy link
Contributor

Has been resolved since 76213b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to existing features project config 🐫 features related to Project config
Projects
None yet
Development

No branches or pull requests

4 participants