diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 5d20431c95dcc..18efeb3d9751f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -137,7 +137,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $validAssetDirs = []; /** @var BundleInterface $bundle */ foreach ($kernel->getBundles() as $bundle) { - if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) { + if (!method_exists($bundle, 'getPublicPath')) { + @trigger_error('Not defining "getPublicPath()" method is deprecated since Symfony 4.4 and will not be supported in 5.0.', E_USER_DEPRECATED); + $publicPath = 'Resources/public'; + } else { + $publicPath = $bundle->getPublicPath(); + } + if (!is_dir($originDir = $bundle->getPath().\DIRECTORY_SEPARATOR.$publicPath)) { continue; } diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 26dea9b205193..c3c1babe4d192 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -135,6 +135,11 @@ public function registerCommands(Application $application) { } + public function getPublicPath(): string + { + return 'Resources/public'; + } + /** * Returns the bundle's container extension class. * diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 88a95d8332942..8dfba0a24457a 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -19,6 +19,8 @@ * BundleInterface. * * @author Fabien Potencier + * + * @method string getPublicPath() Returns relative path for public assets */ interface BundleInterface extends ContainerAwareInterface { diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index f97074e1cdd0f..845e8ceb0a075 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -627,7 +627,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu { $bundle = $this ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') - ->setMethods(['getPath', 'getParent', 'getName']) + ->setMethods(['getPath', 'getPublicPath', 'getParent', 'getName']) ->disableOriginalConstructor() ; @@ -649,6 +649,12 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu ->willReturn($dir) ; + $bundle + ->expects($this->any()) + ->method('getPublicPath') + ->willReturn('Resources/public') + ; + $bundle ->expects($this->any()) ->method('getParent') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy