Giter Site home page Giter Site logo

Comments (20)

leofeyer avatar leofeyer commented on May 28, 2024

We should run the Incenteev script handler at the end (or our handlers first).

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

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.

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

I have adjusted the order of the Composer script handlers in e8e64c1. Together with contao/core-bundle@f02f9ac this should solve the issue. Can you please confirm?

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

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

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

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?

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

Changed in b0f82c6. @dtomasi Please wait a few minutes until packagist has updated its cache and then try again. Thanks for your help.

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

+1 This works perfectly! Thank you!

from standard-edition.

aschempp avatar aschempp commented on May 28, 2024

I thought we do need the framework for our Automator tasks?

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

@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.

from standard-edition.

discordier avatar discordier commented on May 28, 2024

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.

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

But how is the event listener supposed to know about it?

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

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 ;-)

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

see: https://github.com/ContaoBlackforest/core-bundle/commit/5456510d8e94b88f1c4605b7d3c47f64a97d6d1f

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

As discussed on Mumble on March, 26th:

  • The interface should be called Contao\Command\ContaoFrameworkDependentInterface.
  • Discuss the comments in your PR (ContaoBlackforest/core-bundle@5456510d8e94b88f1c4605b7d3c47f64a97d6d1f)
  • We need to add a $this->booted so the Contao framework is not booted twice.

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

The interface should be called Contao\Command\ContaoFrameworkDependentInterface.

Isn´t it Contao\CoreBundle\Command\ContaoFrameworkDependentInterface?

from standard-edition.

Toflar avatar Toflar commented on May 28, 2024

Isn´t it Contao\CoreBundle\Command\ContaoFrameworkDependentInterface?

Of course :)

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

Whats about the $this->booted? Should we create a static privat $isBooted?

from standard-edition.

Toflar avatar Toflar commented on May 28, 2024

Whats about the $this->booted? Should we create a static privat $isBooted?

Yeah but @leofeyer will do :P

from standard-edition.

dtomasi avatar dtomasi commented on May 28, 2024

Ok, should I do a PR of the current state??

from standard-edition.

leofeyer avatar leofeyer commented on May 28, 2024

Closed in favor of the PR (contao/core-bundle#159). @dtomasi Thanks a lot for your help :)

from standard-edition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.