1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the AsmTranslationLoaderBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Marc Aschmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Asm\TranslationLoaderBundle\Command; |
13
|
|
|
|
14
|
|
|
use Asm\TranslationLoaderBundle\Model\TranslationManagerInterface; |
15
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
16
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
17
|
|
|
use Symfony\Component\HttpKernel\KernelInterface; |
18
|
|
|
use Symfony\Component\Translation\Writer\TranslationWriter; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Base class for all AsmTranslationLoaderBundle commands. |
22
|
|
|
* |
23
|
|
|
* @author Christian Flothmann <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
abstract class BaseTranslationCommand extends ContainerAwareCommand |
26
|
|
|
{ |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Returns the configured translation manager. |
30
|
|
|
* |
31
|
|
|
* @return TranslationManagerInterface |
32
|
|
|
*/ |
33
|
5 |
|
protected function getTranslationManager() |
34
|
|
|
{ |
35
|
5 |
|
return $this->getContainer()->get('asm_translation_loader.translation_manager'); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Returns the translation writer. |
40
|
|
|
* |
41
|
|
|
* @return TranslationWriter |
42
|
|
|
*/ |
43
|
2 |
|
protected function getTranslationWriter() |
44
|
|
|
{ |
45
|
2 |
|
return $this->getContainer()->get('translation.writer'); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Returns the current application kernel. |
50
|
|
|
* |
51
|
|
|
* @return KernelInterface |
52
|
|
|
*/ |
53
|
3 |
|
protected function getKernel() |
54
|
|
|
{ |
55
|
3 |
|
return $this->getContainer()->get('kernel'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Returns the Filesystem service. |
60
|
|
|
* |
61
|
|
|
* @return Filesystem |
62
|
|
|
*/ |
63
|
3 |
|
protected function getFilesystem() |
64
|
|
|
{ |
65
|
3 |
|
return $this->getContainer()->get('filesystem'); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|