Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[FrameworkBundle] pass project dir into the assets install command #29840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 6 UPGRADE-4.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ Config
------

* Deprecated using environment variables with `cannotBeEmpty()` if the value is validated with `validate()`

FrameworkBundle
---------------

* Not passing the project directory to the constructor of the `AssetsInstallCommand` is deprecated. This argument will
be mandatory in 5.0.
2 changes: 2 additions & 0 deletions 2 UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ Form
FrameworkBundle
---------------

* The project dir argument of the constructor of `AssetsInstallCommand` is required.

* Removed support for `bundle:controller:action` syntax to reference controllers. Use `serviceOrFqcn::method`
instead where `serviceOrFqcn` is either the service ID when using controllers as services or the FQCN of the controller.

Expand Down
2 changes: 2 additions & 0 deletions 2 src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CHANGELOG
4.3.0
-----

* Not passing the project directory to the constructor of the `AssetsInstallCommand` is deprecated. This argument will
be mandatory in 5.0.
* Added `ControllerTrait::isFormValid()`

4.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ class AssetsInstallCommand extends Command
protected static $defaultName = 'assets:install';

private $filesystem;
private $projectDir;

public function __construct(Filesystem $filesystem)
public function __construct(Filesystem $filesystem, string $projectDir = null)
{
parent::__construct();

if (null === $projectDir) {
@trigger_error(sprintf('Not passing the project directory to the constructor of %s is deprecated since Symfony 4.3 and will not be supported in 5.0.', __CLASS__), E_USER_DEPRECATED);
}

$this->filesystem = $filesystem;
$this->projectDir = $projectDir;
}

/**
Expand Down Expand Up @@ -260,11 +266,11 @@ private function getPublicDirectory(ContainerInterface $container)
{
$defaultPublicDir = 'public';

if (!$container->hasParameter('kernel.project_dir')) {
if (null === $this->projectDir && !$container->hasParameter('kernel.project_dir')) {
return $defaultPublicDir;
}

$composerFilePath = $container->getParameter('kernel.project_dir').'/composer.json';
$composerFilePath = ($this->projectDir ?? $container->getParameter('kernel.project_dir')).'/composer.json';

if (!file_exists($composerFilePath)) {
return $defaultPublicDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<service id="console.command.assets_install" class="Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand">
<argument type="service" id="filesystem" />
<argument>%kernel.project_dir%</argument>
<tag name="console.command" command="assets:install" />
</service>

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.