feature #20642 [FrameworkBundle] Add project directory default for installing assets (Noah Heck)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] Add project directory default for installing assets

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20337
| License       | MIT
| Doc PR        |

This allows the `assets:install` console command to have a fallback default of the project root directory.

Current behavior is to install assets only in the `target` of the current working directory.

Commits
-------

7a11f3ecf3 [FrameworkBundle] Add project directory default for installing assets
This commit is contained in:
Fabien Potencier 2017-03-22 11:06:20 -07:00
commit d378947321

View File

@ -82,7 +82,13 @@ EOT
$targetArg = rtrim($input->getArgument('target'), '/');
if (!is_dir($targetArg)) {
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
$appRoot = $this->getContainer()->getParameter('kernel.root_dir').'/..';
$targetArg = $appRoot.'/'.$targetArg;
if (!is_dir($targetArg)) {
throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
}
}
$this->filesystem = $this->getContainer()->get('filesystem');