Closed dtomasi closed 9 years ago
We should run the Incenteev
script handler at the end (or our handlers first).
I tried a few different orders, but it´s still not working.
If parameters.yml
does not exist when Contao\CoreBundle\Composer\ScriptHandler::addDirectories
is called, it will throw an Exception as well.
I think this happens because Contao\CoreBundle\Command\InstallCommand
is a ContainerAwareCommand
and uses parameters. So at this point Symfony will load config.yml
which tries to import the non existing parameters.yml
on top.
I have adjusted the order of the Composer script handlers in e8e64c133525811231d48bb7513b149ad70c06d6. Together with contao/core-bundle@f02f9ac8faf14b4f4c1433fbe0fe4b813e5d6b54 this should solve the issue. Can you please confirm?
Looks like the ContainerAwareCommand
wasn´t the problem. There is still a RuntimeException
.
composer create-project contao/standard-edition contao4 @dev -vvv
[RuntimeException]
An error occurred while executing the contao:install command.
Exception trace:
() at /private/var/www/d.tomasi/contao4/vendor/contao/core-bundle/src/Composer/ScriptHandler.php:64
Contao\CoreBundle\Composer\ScriptHandler::executeCommand() at /private/var/www/d.tomasi/contao4/vendor/contao/core-bundle/src/Composer/ScriptHandler.php:31
Contao\CoreBundle\Composer\ScriptHandler::addDirectories() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:198
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:166
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:91
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/Installer.php:336
Composer\Installer->run() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/Command/CreateProjectCommand.php:173
Composer\Command\CreateProjectCommand->installProject() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/Command/CreateProjectCommand.php:131
Composer\Command\CreateProjectCommand->execute() at phar:///private/var/www/d.tomasi/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:253
Symfony\Component\Console\Command\Command->run() at phar:///private/var/www/d.tomasi/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///private/var/www/d.tomasi/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/Console/Application.php:147
Composer\Console\Application->doRun() at phar:///private/var/www/d.tomasi/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///private/var/www/d.tomasi/composer.phar/src/Composer/Console/Application.php:84
Composer\Console\Application->run() at phar:///private/var/www/d.tomasi/composer.phar/bin/composer:43
require() at /private/var/www/d.tomasi/composer.phar:25
I found the problem: the console commands are initializing the Contao 3 framework and the Contao 3 framework triggers the Automator::generateSymlinks()
method. I will remove this call from the listener.
@contao/developers Do we really want to initialize the Contao 3 framework on the console?
Changed in b0f82c6fb3210c40e47135b4d83d01ffad777dcb. @dtomasi Please wait a few minutes until packagist has updated its cache and then try again. Thanks for your help.
+1 This works perfectly! Thank you!
I thought we do need the framework for our Automator tasks?
@aschempp Actually we should be able to decide on a per command basis. Similar to extending ContainerAware
there should be a FrameworkDependendCommand
or something alike.
I agree, we should limit the initialization to commands that need the framework.
But please not by extending a command class but by implementing an interface.
But how is the event listener supposed to know about it?
Maybe this could be done by ConsoleEvents::COMMAND
.
with something like this:
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\ConsoleEvents;
public function isFrameworkDependendCommand(ConsoleCommandEvent $event) {
$ref = new ReflectionClass($event->getCommand());
if ($ref->implementsInterface('FrameworkDependentCommand')) {
// Initialize Framework and maybe inject it
}
}
PS.: @leofeyer nice pic ;-)
As discussed on Mumble on March, 26th:
Contao\Command\ContaoFrameworkDependentInterface
.$this->booted
so the Contao framework is not booted twice.The interface should be called Contao\Command\ContaoFrameworkDependentInterface.
Isn´t it Contao\CoreBundle\Command\ContaoFrameworkDependentInterface
?
Isn´t it Contao\CoreBundle\Command\ContaoFrameworkDependentInterface?
Of course :)
Whats about the $this->booted
? Should we create a static privat $isBooted
?
Whats about the $this->booted? Should we create a static privat $isBooted?
Yeah but @leofeyer will do :P
Ok, should I do a PR of the current state??
Closed in favor of the PR (contao/core-bundle#159). @dtomasi Thanks a lot for your help :)
A few days ago i was able to install
contao/standard-edition
viaphp composer.phar create-project contao/standard-edition contao4 @dev
. Afterupload_path
was added toparameters.yml
this doesn´t work anymore.