Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit890ab3f

Browse files
committed
more
1 parent58dd974 commit890ab3f

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
162162
if (null !==$input->getArgument('bundle')) {
163163
try {
164164
$bundle =$kernel->getBundle($input->getArgument('bundle'));
165+
$transPaths = [$bundle->getPath().'/Resources/translations'];
166+
$viewsPaths = [$bundle->getPath().'/Resources/views'];
165167
if (method_exists($bundle,'getBundleDir')) {
166-
$transPaths = [$bundle->getBundleDir().'/translations'];
167-
$viewsPaths = [$bundle->getBundleDir().'/templates'];
168-
}else {
169-
$transPaths = [$bundle->getPath().'/Resources/translations'];
170-
$viewsPaths = [$bundle->getPath().'/Resources/views'];
168+
if (is_dir($bundle->getBundleDir().'/translations')) {
169+
$transPaths = [$bundle->getBundleDir().'/translations'];
170+
}
171+
if (is_dir($bundle->getBundleDir().'/templates')) {
172+
$viewsPaths = [$bundle->getBundleDir().'/templates'];
173+
}
171174
}
172175
if ($this->defaultTransPath) {
173176
$transPaths[] =$this->defaultTransPath;
@@ -211,11 +214,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
211214
}
212215
}elseif ($input->getOption('all')) {
213216
foreach ($kernel->getBundles()as$bundle) {
214-
if (method_exists($bundle,'getBundleDir')) {
217+
if (method_exists($bundle,'getBundleDir') &&is_dir($bundle->getBundleDir().'/translations')) {
215218
$transPaths[] =$bundle->getBundleDir().'/translations';
216-
$viewsPaths[] =$bundle->getBundleDir().'/templates';
217219
}else {
218220
$transPaths[] =$bundle->getPath().'/Resources/translations';
221+
}
222+
if (method_exists($bundle,'getBundleDir') &&is_dir($bundle->getBundleDir().'/templates')) {
223+
$viewsPaths[] =$bundle->getBundleDir().'/templates';
224+
}else {
219225
$viewsPaths[] =$bundle->getPath().'/Resources/views';
220226
}
221227
if (is_dir($deprecatedPath =sprintf('%s/Resources/%s/translations',$rootDir,$bundle->getName()))) {

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
153153
// Override with provided Bundle info
154154
if (null !==$input->getArgument('bundle')) {
155155
try {
156-
$transPaths = [];
157-
$viewsPaths = [];
158156
$foundBundle =$kernel->getBundle($input->getArgument('bundle'));
157+
$transPaths = [$foundBundle->getPath().'/Resources/translations'];
158+
$viewsPaths = [$foundBundle->getPath().'/Resources/views'];
159159
if (method_exists($foundBundle,'getBundleDir')) {
160-
$transPaths = [$foundBundle->getBundleDir().'/translations'];
161-
$viewsPaths = [$foundBundle->getBundleDir().'/templates'];
162-
}else {
163-
$transPaths = [$foundBundle->getPath().'/Resources/translations'];
164-
$viewsPaths = [$foundBundle->getPath().'/Resources/views'];
160+
if (is_dir($foundBundle->getBundleDir().'/translations')) {
161+
$transPaths = [$foundBundle->getBundleDir().'/translations'];
162+
}
163+
if (is_dir($foundBundle->getBundleDir().'/templates')) {
164+
$viewsPaths = [$foundBundle->getBundleDir().'/templates'];
165+
}
165166
}
166167
if ($this->defaultTransPath) {
167168
$transPaths[] =$this->defaultTransPath;

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/BundlePathsTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public function testCustomBundleTwigTemplatesPath()
5757
{
5858
static::bootKernel(['test_case' =>'BundlePaths']);
5959
$bundlesMetadata =static::$container->getParameter('kernel.bundles_metadata');
60-
$bundlePath =$bundlesMetadata['ModernBundle']['dir'];
60+
$bundleDir =$bundlesMetadata['ModernBundle']['dir'];
6161

6262
$twig =static::$container->get('twig');
63-
$this->assertSame([$bundlePath.'/templates'],$twig->getLoader()->getPaths('Modern'));
63+
$this->assertSame([$bundleDir.'/templates'],$twig->getLoader()->getPaths('Modern'));
6464
$this->assertSame("OK\n",$twig->render('@Modern/index.html.twig'));
6565
}
6666

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp