6
6
use Markup \JobQueueBundle \Exception \InvalidConfigurationException ;
7
7
use Markup \JobQueueBundle \Exception \MissingScheduleException ;
8
8
use Markup \JobQueueBundle \Exception \MissingConfigurationException ;
9
- use Markup \JobQueueBundle \Factory \ JobStatusFactory ;
9
+ use Markup \JobQueueBundle \Repository \ JobStatusRepository ;
10
10
use Markup \JobQueueBundle \Model \RecurringConsoleCommandConfiguration ;
11
11
use Symfony \Component \Finder \Finder ;
12
12
use Symfony \Component \Finder \SplFileInfo ;
@@ -38,15 +38,15 @@ class RecurringConsoleCommandReader
38
38
* @param string $kernelPath
39
39
*/
40
40
41
- /** @var JobStatusFactory */
42
- private $ jobStatusFactory ;
41
+ /** @var JobStatusRepository */
42
+ private $ jobStatusRepository ;
43
43
44
44
public function __construct (
45
45
string $ kernelPath ,
46
- JobStatusFactory $ jobStatusFactory
46
+ JobStatusRepository $ jobStatusRepository
47
47
) {
48
48
$ this ->kernelPath = $ kernelPath ;
49
- $ this ->jobStatusFactory = $ jobStatusFactory ;
49
+ $ this ->jobStatusRepository = $ jobStatusRepository ;
50
50
}
51
51
52
52
public function setConfigurationFileName ($ name )
@@ -149,7 +149,7 @@ private function parseConfiguration(array $config)
149
149
isset ($ group ['timeout ' ]) ? $ group ['timeout ' ] : null ,
150
150
isset ($ group ['envs ' ]) ? $ group ['envs ' ] : null ,
151
151
isset ($ group ['user_managed ' ]) ? $ group ['user_managed ' ] : null ,
152
- isset ($ group ['user_managed ' ]) ? $ this ->jobStatusFactory -> isStatusEnabled ($ group[ ' command ' ], isset ( $ group [ ' arguments ' ]) ? json_encode ( $ group [ ' arguments ' ]) : null ) : null
152
+ isset ($ group ['user_managed ' ]) ? $ this ->jobStatusEnabled ($ group ) : null
153
153
);
154
154
155
155
$ configurations ->add ($ recurringConsoleCommandConfiguration );
@@ -158,6 +158,13 @@ private function parseConfiguration(array $config)
158
158
return $ configurations ;
159
159
}
160
160
161
+ private function jobStatusEnabled (array $ group ): bool
162
+ {
163
+ $ arguments = isset ($ group ['arguments ' ]) ? json_encode ($ group ['arguments ' ]) : null ;
164
+
165
+ return $ this ->jobStatusRepository ->isStatusEnabled ($ group ['command ' ], $ arguments );
166
+ }
167
+
161
168
/**
162
169
* Reads the configuration file using the yml component and returns an array
163
170
* @return array
0 commit comments