Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
From #2408371-90: Proxies of module interfaces don't work:
Reopening for a question: is it intentional that the
generate-proxy-class
script that was added here only works for modules that are enabled?I'd just been trying for 20 minutes to figure out what's wrong for a new module that was therefore not yet installed. Turns out this is what's wrong: I had not yet enabled the module… that I was trying to develop.
Proposed resolution
TBD
Remaining tasks
TBD
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #1
Fabianx CreditAttribution: Fabianx as a volunteer commentedThat is likely not intentional, but probably a side effect related to the autoloading strategy used by Drupal for modules.
In any case we should give a good error message, when we can't find the module (and detect a potential module namespace).
Comment #2
dawehnerYes we need a working autoloading in order to generate the proxy. We need that as we use reflection for those classes/interface, see
+1
Comment #11
DuneBLI would add that the
generate-proxy-class.php
script does not work in a multi site environment.It is trying to load the default DB and there is no way to set an alias to make it point to another site/db
..or maybe I missed something
Comment #12
apadernoComment #16
catchMoving this to a task since it's purely a DX nicety and can't affect runtime code as such, but agreed a nice error message would be good here.
Comment #17
quietone CreditAttribution: quietone at PreviousNext commentedThis was a bugsmash daily target, adding tag.
Comment #19
quietone CreditAttribution: quietone at PreviousNext commented@Wim Leers, thanks for making this issue!
Yes, an error message would be helpful. Like @Wim Leers, I wasted too much trying to figure out why the script was no working while I was working on what I thought would be a simple issue, #3092424: ProxyBuilder generates incorrect @see reference.