Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33ec2d8

Browse files
committed
Remove hard-coding of "Resources/public/" path for assets
1 parent dca9325 commit 33ec2d8

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
137137
$validAssetDirs = [];
138138
/** @var BundleInterface $bundle */
139139
foreach ($kernel->getBundles() as $bundle) {
140-
if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) {
140+
if (!is_dir($originDir = $bundle->getPath().$bundle->getPublicPath())) {
141141
continue;
142142
}
143143

src/Symfony/Component/HttpKernel/Bundle/Bundle.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ public function registerCommands(Application $application)
135135
{
136136
}
137137

138+
public function getPublicPath()
139+
{
140+
return '/Resources/public';
141+
}
142+
138143
/**
139144
* Returns the bundle's container extension class.
140145
*

src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,12 @@ public function getNamespace();
6868
* @return string The Bundle absolute path
6969
*/
7070
public function getPath();
71+
72+
/**
73+
* Gets relative path for public assets (with leading slash).
74+
* E.g. "/Resources/public".
75+
*
76+
* @return string The relative path for public assets
77+
*/
78+
public function getPublicPath();
7179
}

0 commit comments

Comments
 (0)