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.
I've used numerous Symfony components in different add on modules for Aegir, in devshop and others.
It would be nice if we could add things like Process component, which would allow shell exec's with realtime feedback.
The upcoming branch adds a composer.json and vendor folder with the same version of symfony/class-loader we already have.
Now we can add packages to composer.json and use "use":
require_once dirname(__FILE__) . "/vendor/autoload.php";
use Symfony\Component\ClassLoader\UniversalClassLoader;
Note that currently, Provision is using the oldest available version of symfony/class-loader
, so we might want to update that as well: https://packagist.org/packages/symfony/class-loader#2.0.4
Comment | File | Size | Author |
---|---|---|---|
#7 | 2957156-composer-loader.patch | 44.69 KB | Jon Pugh |
Comments
Comment #2
Jon PughComment #3
Jon PughFor your review.
Comment #5
Jon PughDoesn't work yet, something with the autoloader.
Comment #7
Jon PughYeah, my mistake! The composer-generated autoloader replaces class-loader.
I was able to get it working with just a minor change to provision code and the addition of composer.json, composer.update, and the vendor dir.
Comment #8
Jon PughSome details: I was trying to see if I could remove the redundant hook_init() and hook_provision_register_autoload() functions that are required if you create your own Context Service or Config classes.
I added the two additional paths (db/Provision and http/Provision) to the psr-0 namespace config in composer.json, but when I removed db_provision_register_autoload(), db_drush_init(), and db_provision_register_autoload() it broke again.
I'm going to keep poking at it, I think we can just call provision_autoload_register_prefix() directly in hook_drush_init, and remove the extra hook_provision_register_autoload() functions. Since provision_autoload() already uses a static instance of the Classloader, I don't think we need some of these functions.
Comment #9
Jon PughFYI it DID work when I moved all the db and http code to the same folder, so it was all in the same namespace.
Comment #11
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedI updated a few strings in the composer.json file...
So we could safely merge the current state and refactor later? Or would it be better to dig a little deeper?
Comment #12
Jon PughYeah, if it works now I say go for it.
Any further development on this isn't really worth it since the branch will be deprecated at some point.
Comment #14
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedMerged
Comment #15
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThanks Jon ... one step closer to provision4
Comment #17
Jon PughThis is fantastic, helmo!
We can now add Provision3 to Packagist, and require it in Provision4, which should let us figure out a way to load in all the 3.x drush commands.
Thanks for committing.