0

I have an entity and I am not sure what I should use. On the one hand, configuration fields are easier to use via the UI, why should I consider base fields?

By using base fields everything is stored in the same table, would there be any kind of performance improvement if I have many entities?

I can't find anywhere where it is explained why to opt for one or the other. Thank you very much

2
  • 1
    Yes, that's it. It's not only easier to configure fields in UI, it's also easier to deploy the changes. If you change a base field in a module you need to write an update hook.
    – 4uk4
    Commented Aug 9, 2021 at 12:02
  • 1
    You should add that as an answer 4k4. But maybe word it as a pros and cons of each, for people to determine which better suits their needs and skills. Even though base fields are more of a hassle to maintain, for certain entity types I prefer to use them due to the architectural paradigm of it actually being a fundamental field to the entity, as well as the ensuing performance benefits. But the config fields are much easier to work with, and with entity caching removes the difference after initial load anyways.
    – Jaypan
    Commented Aug 9, 2021 at 18:30

1 Answer 1

1

Your question contains already the key points to consider. It's not only easier to configure fields in UI, it's also easier to deploy the changes. If you change a base field in a module you need to write an update hook.

On the other hand, if changes to the fields are unlikely and you expect a very high number of entities then use base fields like core for the alias entity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.