- Entity Controllers need to be services so they can get things like database connection or cache backends/bins injected (e.g. storage controller).
- The entity manager should be able to get instances of the controllers, without getting them injected, as we want them to be lazy loaded.
Note: This requirement differs from the one outlined inbecause we don’t really want to inject the controllers into our plugin instances but instead register them with the plugin manager. In return, the plugin manager would get forwarded to the plugin instances upon instantiation so that we can easily access it in places like $entity->save(), $entity->delete() or $entity->view().
- Make controllers services, so they define their dependencies. The database entity storage controller, for example would get a database connection and a cache backend injected, whilst the config entity storage controller would get the config storage injected.
- In order to let the entity manager lazy load controllers on the fly it should get a controller factory, which is itself ContainerAware. This allows the controller factory to load the required services from the container on demand, and keeping the memory footprint as low as possible.
- We would then register our entity controller services with that controller factory... Possibly through a compiler pass or other means.
- This proposal requires controllers to be defined as services. Unless we want to come up with a syntax to define services including dependencies, etc. in the annotations of the controller class we will have to register our controllers manually (e.g. NodeBundle).
- In the long run, however, we might be able to use this to decouple the controller definitions from the entity class annotations and instead simply rely on unique service names to register controllers for entity types. Simply put, we could turn the coupling of entity class and entity controllers upside down.
PASSED: [[SimpleTest]]: [MySQL] 55,737 pass(es).
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1909418-95.patch. Unable to apply patch. See the log in the details link for more information.
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1909418-94.patch. Unable to apply patch. See the log in the details link for more information.
PASSED: [[SimpleTest]]: [MySQL] 55,890 pass(es).