Skip to content

Best way to override ServerRunCommand and ServerStartCommand? #20429

Closed
@pocky

Description

@pocky

Hello,

I am using a non-standard folder structure and I just discovered a "problem" with server:run and server:start (for me it's a DX) :

        $documentRoot = $input->getOption('docroot');

        if (null === $documentRoot) {
            $documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web';
        }

For my distribution, the $documentRoot should be : $this->getContainer()->getParameter('kernel.root_dir').'/../../web'

I don't want to tell to each dev wich using my distribution to add the --docroot option (or using an alias via composer scripts/make) so I'm looking to the best way to change this.

Solutions :

1- ServerRunCommand and ServerStartCommand should be used as services to allow overriding
2- Add a getDocumentRoot option in Kernel and use the parameter instead of relative path (simpler)
3- Create a symfony/server-bundle with all related server commands as dependency of framework-bundle

What's your opinion?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions