-1

Currently, I'm working on Sylius framework. I need to override a few fields from Base models. It can be like changing field type, or changing field length, add null/not null/unique condition etc. How can we override this without touching core files Or ignoring existing fields and creating new fields with a similar name?

stefun
  • 893
  • 1
  • 20
  • 49
  • I don't know anything about sylius, but usually you extend the core files and override the parts you want to change. After that, set configs in config files to use your customized model ... did you already read this? http://docs.sylius.com/en/1.2/customization/model.html – Jim Panse Jul 16 '18 at 08:12
  • yes, it will work for new fields. But for existing fields in base model if I need to change fields type etc. how we can do that? – stefun Jul 16 '18 at 09:27
  • Why only for new fields? As long if they are not private, you can override whatever you want ... – Jim Panse Jul 16 '18 at 09:35

1 Answers1

0

Not suggest to change the field type but create a new one.

But if you really want to make change, I guess should be similar to create a new field?

Have a check on the official doc: http://docs.sylius.com/en/1.2/customization/model.html

Code
  • 71
  • 8