16
16
use Symfony \Component \Console \Input \InputInterface ;
17
17
use Symfony \Component \Console \Output \OutputInterface ;
18
18
use Symfony \Component \Console \Style \SymfonyStyle ;
19
- use Symfony \Component \DependencyInjection \ContainerInterface ;
19
+ use Symfony \Component \DependencyInjection \ParameterBag \ ParameterBagInterface ;
20
20
use Symfony \Component \Translation \Translator ;
21
21
use Symfony \Contracts \Translation \TranslatorInterface ;
22
22
@@ -47,7 +47,7 @@ class MigrateToDatabaseCommand extends Command
47
47
protected static $ defaultName = 'creative:db-i18n:migrate ' ;
48
48
49
49
/**
50
- * @var ContainerInterface
50
+ * @var ParameterBagInterface
51
51
*/
52
52
private $ container ;
53
53
@@ -74,17 +74,17 @@ class MigrateToDatabaseCommand extends Command
74
74
/**
75
75
* MigrateToDatabaseCommand constructor.
76
76
*
77
- * @param ContainerInterface $container
78
- * @param TranslatorInterface $translator
79
- * @param ManagerRegistry $doctrine
80
- * @param string|null $name
77
+ * @param ParameterBagInterface $container
78
+ * @param TranslatorInterface $translator
79
+ * @param ManagerRegistry $doctrine
80
+ * @param string|null $name
81
81
*/
82
- public function __construct (ContainerInterface $ container , TranslatorInterface $ translator , ManagerRegistry $ doctrine , string $ name = null )
82
+ public function __construct (ParameterBagInterface $ container , TranslatorInterface $ translator , ManagerRegistry $ doctrine , string $ name = null )
83
83
{
84
84
parent ::__construct ($ name );
85
85
$ this ->container = $ container ;
86
86
$ this ->translator = $ translator ;
87
- $ this ->entityClass = $ this ->container ->getParameter ('db_i18n.entity ' );
87
+ $ this ->entityClass = $ this ->container ->get ('db_i18n.entity ' );
88
88
$ this ->doctrine = $ doctrine ;
89
89
}
90
90
@@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
113
113
throw new RuntimeException ('Translator service of application has no \'getCatalogue \' method ' );
114
114
}
115
115
116
- if (!$ this ->container ->hasParameter ('locales ' ) || !is_array ($ this ->container ->getParameter ('locales ' ))) {
116
+ if (!$ this ->container ->has ('locales ' ) || !is_array ($ this ->container ->get ('locales ' ))) {
117
117
throw new RuntimeException ('Application container must have a \'locales \' parameter, and this parameter must be an array ' );
118
118
}
119
119
@@ -125,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
125
125
$ catalogue = $ this ->translator ->getCatalogue ($ locale );
126
126
127
127
$ forExport = $ catalogue ->all ($ domain );
128
- $ exported = $ this ->exportToDatabase ($ forExport , $ locale , $ this ->container ->getParameter ('db_i18n.domain ' ));
128
+ $ exported = $ this ->exportToDatabase ($ forExport , $ locale , $ this ->container ->get ('db_i18n.domain ' ));
129
129
130
130
$ io ->writeln (sprintf (
131
131
'Loaded form %s: %u messages, exported to database: %s ' ,
@@ -210,7 +210,7 @@ protected function checkEntityExists(string $locale, string $key): EntityInterfa
210
210
*/
211
211
protected function getLocale (string $ filename ): ?string
212
212
{
213
- $ locales = $ this ->container ->getParameter ('locales ' );
213
+ $ locales = $ this ->container ->get ('locales ' );
214
214
$ locale = null ;
215
215
foreach ($ locales as $ localeParam ) {
216
216
if (strpos ($ filename , $ localeParam ) !== false ) {
@@ -236,7 +236,7 @@ protected function locateFile(string $path): string
236
236
if (strpos ($ path , '/ ' ) === 0 ) {
237
237
$ realPath = $ path ;
238
238
} else {
239
- $ realPath = $ this ->container ->getParameter ('kernel.root_dir ' ) . '/../ ' . $ path ;
239
+ $ realPath = $ this ->container ->get ('kernel.root_dir ' ) . '/../ ' . $ path ;
240
240
}
241
241
242
242
if (!is_file ($ realPath ) || !is_readable ($ realPath )) {
0 commit comments