8000 [FrameworkBundle] Fix PathPackage CLI usage by lenybernard · Pull Request #10264 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Fix PathPackage CLI usage #10264

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

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</service>

<service id="templating.asset.path_package" class="%templating.asset.path_package.class%" abstract="true">
<argument type="service" id="request" />
<argument type="service" id="request_stack" />
<argument /> <!-- version -->
<argument /> <!-- version format -->
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

namespace Symfony\Bundle\FrameworkBundle\Templating\Asset;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Templating\Asset\PathPackage as BasePathPackage;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Request;

/**
* The path packages adds a version and a base path to asset URLs.
Expand All @@ -24,12 +25,18 @@ class PathPackage extends BasePathPackage
/**
* Constructor.
*
* @param Request $request The current request
* @param string $version The version
* @param string $format The version format
* @param Request $requestStack The current request
* @param string $version The version
* @param string $format The version format
*/
public function __construct(Request $request, $version = null, $format = null)
public function __construct(RequestStack $requestStack, $version = null, $format = null)
{
parent::__construct($request->getBasePath(), $version, $format);
if ($requestStack->getCurrentRequest() instanceof Request) {
$path = $requestStack->getCurrentRequest()->getBasePath();
} else {
$path = "/";
}

parent::__construct($path, $version, $format);
}
}
0