Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291828

Remove entity dependency on plugins, promote EntityType to a domain object

$
0
0

This patch removes Entity type's dependency on Plugins among other things.

I kept the annotation, but moved discovery of entity types to yaml files. It may seem like an unnecessary extra step, but the effort is minimal, and it saves us having to put entities in unintuitive namespaces, and no directory iteration is required to find them.

I also kept the EntityManager interface more or less the same, even though it's not a plugin manager anymore. There are some obvious refactorings there, but I figured that can wait in the interest of not breaking everything.

Since entity types don't have the same requirements of plugins (there won't be nearly as many of them), the annotation reader just uses reflection. It's quite a bit faster, and the memory overhead is minimal. The annotations are also parsed on demand for each entity type, so we don't incur the overhead of parsing all of them they aren't needed.

The bigger change in this patch is making the EntityType annotation a real domain object. That may seem like an odd choice, but I've been wanting to add an EntityType class for a while and the annotation is already getting injected with all the values it would need, so using this class seemed sensible. There are still many missing methods, but it should be enough to see what's going on. This also exposed some bugs where EntityType was missing at least 3 keys and there seems to be a bug around not having revision_table.

The change from direct access to the entity info array to methods is already much cleaner. We've got the details of that data structure spread all over and having proper methods have already eliminated some conditionals. It should prevent refactorings of entity types from bleeding into the entire system as well.

This patch also adds a reusable way to gather core/module info from yaml files like we already do with routing, services, and info. I was a bit surprised to see that none of them are currently sharing this code.

Please keep in mind that this is totally unfinished. I converted just enough to make the front page not fatal. Figured this is a big enough change to get buy in before finishing it. This is also missing any persistent caching, which may be necessary, but did not seem urgent based on initial profiling.

AttachmentSizeStatusTest resultOperations
entity-no-plugins.patch62.7 KBIdleFAILED: [[SimpleTest]]: [MySQL] Setup environment: Test cancelled by admin prior to completion.View details | Re-test

Viewing all articles
Browse latest Browse all 291828

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>