10
10
use HDNET \Importr \Domain \Repository \StrategyRepository ;
11
11
use HDNET \Importr \Service \ImportServiceInterface ;
12
12
use HDNET \Importr \Service \Manager ;
13
+ use Psr \Http \Message \ResponseInterface ;
13
14
use TYPO3 \CMS \Core \Messaging \FlashMessage ;
14
15
use TYPO3 \CMS \Core \Messaging \FlashMessageService ;
15
16
use TYPO3 \CMS \Core \Resource \ResourceFactory ;
@@ -62,7 +63,7 @@ public function __construct(
62
63
$ this ->importService = $ importService ;
63
64
}
64
65
65
- public function indexAction ()
66
+ public function indexAction (): ResponseInterface
66
67
{
67
68
$ combinedIdentifier = GeneralUtility::_GP ('id ' );
68
69
if (isset ($ combinedIdentifier ) && \is_string ($ combinedIdentifier )) {
@@ -75,37 +76,41 @@ public function indexAction()
75
76
$ this ->view ->assign ('folder ' , $ files );
76
77
}
77
78
$ this ->view ->assign ('imports ' , $ this ->importRepository ->findUserQueue ());
79
+
80
+ return $ this ->htmlResponse ($ this ->view ->render ());
78
81
}
79
82
80
83
/**
81
84
* @param string $identifier
82
85
*/
83
- public function importAction ($ identifier )
86
+ public function importAction ($ identifier ): ResponseInterface
84
87
{
85
88
$ file = $ this ->resourceFactory ->getObjectFromCombinedIdentifier ($ identifier );
86
89
$ this ->view ->assign ('file ' , $ file );
87
90
$ this ->view ->assign ('strategies ' , $ this ->strategyRepository ->findAllUser ());
91
+ return $ this ->htmlResponse ($ this ->view ->render ());
88
92
}
89
93
90
94
/**
91
95
* @param string $identifier
92
96
* @param \HDNET\Importr\Domain\Model\Strategy $strategy
93
97
*/
94
- public function previewAction ($ identifier , Strategy $ strategy )
98
+ public function previewAction ($ identifier , Strategy $ strategy ): ResponseInterface
95
99
{
96
100
$ file = $ this ->resourceFactory ->getObjectFromCombinedIdentifier ($ identifier );
97
101
$ this ->view ->assign ('filepath ' , $ file ->getPublicUrl ());
98
102
$ this ->view ->assign ('strategy ' , $ strategy );
99
103
100
104
$ previewData = $ this ->importManager ->getPreview ($ strategy , $ file ->getPublicUrl ());
101
105
$ this ->view ->assign ('preview ' , $ previewData );
106
+ return $ this ->htmlResponse ($ this ->view ->render ());
102
107
}
103
108
104
109
/**
105
110
* @param string $filepath
106
111
* @param \HDNET\Importr\Domain\Model\Strategy $strategy
107
112
*/
108
- public function createAction ($ filepath , Strategy $ strategy )
113
+ public function createAction ($ filepath , Strategy $ strategy ): ResponseInterface
109
114
{
110
115
$ this ->importService ->addToQueue ($ filepath , $ strategy );
111
116
$ text = 'The Import file %s width the strategy %s was successfully added to the queue ' ;
@@ -117,22 +122,22 @@ public function createAction($filepath, Strategy $strategy)
117
122
true
118
123
);
119
124
120
- $ flashMessageService = $ this -> objectManager -> get (
125
+ $ flashMessageService = GeneralUtility:: makeInstance (
121
126
FlashMessageService::class
122
127
);
123
128
$ messageQueue = $ flashMessageService ->getMessageQueueByIdentifier ();
124
129
$ messageQueue ->addMessage ($ message );
125
130
126
- $ this ->redirect ('index ' );
131
+ return $ this ->redirect ('index ' );
127
132
}
128
133
129
134
/**
130
135
* @param Import $import
131
136
*/
132
- public function resetAction (Import $ import )
137
+ public function resetAction (Import $ import ): ResponseInterface
133
138
{
134
139
$ import ->reset ();
135
140
$ this ->importRepository ->update ($ import );
136
- $ this ->redirect ('index ' );
141
+ return $ this ->redirect ('index ' );
137
142
}
138
143
}
0 commit comments