Best-practice for Entities using ORM-Annotations or loadMetadata()

The CitrixEvent has some annotations. Not sure why as it also has the loadMetadata() method with the same info:

The decision to go with loadMetadata over annotations was made due to massive amount of cache files it generated which cause troubles when hosting several hundreds of Mautic instances. Did you know that a file system has a limit of amount of files it can hold? So that limit was reached and the solution at the time was to get rid of yaml files, twig and annotations and so the cache size decreased considerably. That’s just the history behind the decision.

Now we continue to do it this way to keep consistency. We are forced to refactor PHP templates with Twig in Mautic 5 as PHP template support was dropped in Symfony 5. That was massive undertaking. On the other hand, the Symfony community seem to be going from yaml configs towards PHP configs. It’s interesting to look back at some decisions made almost a decade ago and see how it turned out.

2 Likes