1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PlaygroundGame\Controller\Admin; |
4
|
|
|
|
5
|
|
|
use PlaygroundGame\Service\Game as AdminGameService; |
6
|
|
|
use Zend\Mvc\Controller\AbstractActionController; |
7
|
|
|
use Zend\View\Model\ViewModel; |
8
|
|
|
use PlaygroundGame\Options\ModuleOptions; |
9
|
|
|
use Zend\Paginator\Paginator; |
10
|
|
|
use DoctrineORMModule\Paginator\Adapter\DoctrinePaginator as DoctrineAdapter; |
11
|
|
|
use PlaygroundCore\ORM\Pagination\LargeTablePaginator; |
12
|
|
|
use Doctrine\ORM\Tools\Pagination\Paginator as ORMPaginator; |
13
|
|
|
use Zend\Stdlib\ErrorHandler; |
14
|
|
|
use Zend\ServiceManager\ServiceLocatorInterface; |
15
|
|
|
use Zend\Session\Container; |
16
|
|
|
use ZfcDatagrid\Column; |
17
|
|
|
use ZfcDatagrid\Action; |
18
|
|
|
use ZfcDatagrid\Column\Formatter; |
19
|
|
|
use ZfcDatagrid\Column\Type; |
20
|
|
|
use ZfcDatagrid\Column\Style; |
21
|
|
|
use ZfcDatagrid\Filter; |
22
|
|
|
|
23
|
|
|
class GameController extends AbstractActionController |
24
|
|
|
{ |
25
|
|
|
protected $options; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var \PlaygroundGame\Service\Game |
29
|
|
|
*/ |
30
|
|
|
protected $adminGameService; |
31
|
|
|
|
32
|
|
|
protected $game; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* |
36
|
|
|
* @var ServiceManager |
37
|
|
|
*/ |
38
|
|
|
protected $serviceLocator; |
39
|
|
|
|
40
|
|
|
public function __construct(ServiceLocatorInterface $locator) |
41
|
|
|
{ |
42
|
|
|
$this->serviceLocator = $locator; |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function getServiceLocator() |
46
|
|
|
{ |
47
|
|
|
return $this->serviceLocator; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function checkGame() |
51
|
|
|
{ |
52
|
|
|
$gameId = $this->getEvent()->getRouteMatch()->getParam('gameId'); |
53
|
|
|
if (!$gameId) { |
54
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
$game = $this->getAdminGameService()->getGameMapper()->findById($gameId); |
58
|
|
|
if (!$game) { |
59
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
$this->game = $game; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function createForm($form) |
65
|
|
|
{ |
66
|
|
|
// I use the wonderful Form Generator to create the Player form |
67
|
|
|
$this->forward()->dispatch( |
68
|
|
|
'playgroundcore_admin_formgen', |
69
|
|
|
array( |
70
|
|
|
'controller' => 'playgroundcore_admin_formgen', |
71
|
|
|
'action' => 'create' |
72
|
|
|
) |
73
|
|
|
); |
74
|
|
|
|
75
|
|
|
if ($this->getRequest()->isPost()) { |
|
|
|
|
76
|
|
|
$data = $this->getRequest()->getPost()->toArray(); |
|
|
|
|
77
|
|
|
$form = $this->getAdminGameService()->createForm($data, $this->game, $form); |
78
|
|
|
if ($form) { |
79
|
|
|
$this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The form was created'); |
|
|
|
|
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
$formTemplate=''; |
83
|
|
|
if ($form) { |
84
|
|
|
$formTemplate = $form->getFormTemplate(); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
return array( |
88
|
|
|
'form' => $form, |
89
|
|
|
'formTemplate' => $formTemplate, |
90
|
|
|
'gameId' => $this->game->getId(), |
91
|
|
|
'game' => $this->game, |
92
|
|
|
); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param string $templatePath |
97
|
|
|
* @param string $formId |
98
|
|
|
*/ |
99
|
|
|
public function editGame($templatePath, $formId) |
100
|
|
|
{ |
101
|
|
|
// We try to get FB pages from the logged in user |
102
|
|
|
$session = new Container('facebook'); |
103
|
|
|
$config = $this->getServiceLocator()->get('config'); |
104
|
|
|
$appsArray = []; |
105
|
|
|
$platformFbAppId = ''; |
106
|
|
|
|
107
|
|
|
if (isset($config['facebook'])) { |
108
|
|
|
$platformFbAppId = $config['facebook']['fb_appid']; |
109
|
|
|
$platformFbAppSecret = $config['facebook']['fb_secret']; |
110
|
|
|
} |
111
|
|
|
$fb = new \Facebook\Facebook([ |
112
|
|
|
'app_id' => $platformFbAppId, |
113
|
|
|
'app_secret' => $platformFbAppSecret, |
|
|
|
|
114
|
|
|
'default_graph_version' => 'v3.1', |
115
|
|
|
]); |
116
|
|
|
|
117
|
|
|
$helper = $fb->getRedirectLoginHelper(); |
118
|
|
|
$fb_args_param = array('req_perms' => 'manage_pages,publish_pages'); |
119
|
|
|
$fb_login_url = $helper->getLoginUrl($this->adminUrl()->fromRoute( |
|
|
|
|
120
|
|
|
'playgroundgame/list', |
121
|
|
|
array(), |
122
|
|
|
array('force_canonical' => true) |
123
|
|
|
), $fb_args_param); |
124
|
|
|
$accessToken = $helper->getAccessToken(); |
125
|
|
|
|
126
|
|
|
if (isset($accessToken) || $session->offsetExists('fb_token')) { |
127
|
|
|
if (isset($accessToken)) { |
128
|
|
|
$session->offsetSet('fb_token', $accessToken); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
// checking if user access token is not valid then ask user to login again |
132
|
|
|
$debugToken = $fb->get('/debug_token?input_token='. $session->offsetGet('fb_token'), $platformFbAppId . '|' . $platformFbAppSecret) |
133
|
|
|
->getGraphNode() |
134
|
|
|
->asArray(); |
135
|
|
|
if (isset($debugToken['error']['code'])) { |
136
|
|
|
$session->offsetUnset('fb_token'); |
137
|
|
|
} else { |
138
|
|
|
// setting default user access token for future requests |
139
|
|
|
$fb->setDefaultAccessToken($session->offsetGet('fb_token')); |
140
|
|
|
$pages = $fb->get('/me/accounts') |
141
|
|
|
->getGraphEdge() |
142
|
|
|
->asArray(); |
143
|
|
|
|
144
|
|
|
foreach ($pages as $key) { |
145
|
|
|
$app_label = ''; |
146
|
|
|
if (isset($key['name'])) { |
147
|
|
|
$app_label .= $key['name']; |
148
|
|
|
} |
149
|
|
|
if (isset($key['id'])) { |
150
|
|
|
$app_label .= ' ('.$key['id'].')'; |
151
|
|
|
} |
152
|
|
|
$appsArray[$key['id']] = $app_label; |
153
|
|
|
} |
154
|
|
|
$fb_login_url = ''; |
155
|
|
|
|
156
|
|
|
if ($this->getRequest()->isPost()) { |
|
|
|
|
157
|
|
|
$data = array_replace_recursive( |
158
|
|
|
$this->getRequest()->getPost()->toArray(), |
|
|
|
|
159
|
|
|
$this->getRequest()->getFiles()->toArray() |
|
|
|
|
160
|
|
|
); |
161
|
|
|
// Removing a previously page tab set on this game |
162
|
|
|
if ($this->game && |
163
|
|
|
!empty($this->game->getFbPageId()) && |
164
|
|
|
!empty($this->game->getFbAppId()) && |
165
|
|
|
( |
166
|
|
|
( |
167
|
|
|
$this->game->getFbPageId() !== $data['fbPageId'] || |
168
|
|
|
$this->game->getFbAppId() !== $data['fbAppId'] |
169
|
|
|
) || |
170
|
|
|
$data['broadcastFacebook'] == 0 |
171
|
|
|
) |
172
|
|
|
) { |
173
|
|
|
$oldPage = $fb->get('/' . $this->game->getFbPageId() . '?fields=access_token,name,id') |
174
|
|
|
->getGraphNode() |
175
|
|
|
->asArray(); |
176
|
|
|
$removeTab = $fb->delete( |
|
|
|
|
177
|
|
|
'/' . $this->game->getFbPageId() . '/tabs', |
178
|
|
|
[ |
179
|
|
|
'tab' => 'app_'.$this->game->getFbAppId(), |
180
|
|
|
], |
181
|
|
|
$oldPage['access_token'] |
182
|
|
|
) |
183
|
|
|
->getGraphNode() |
184
|
|
|
->asArray(); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
// Removing a previously post set on this game |
188
|
|
|
if ($this->game && |
189
|
|
|
!empty($this->game->getFbPostId()) && |
190
|
|
|
$data['broadcastPostFacebook'] == 0 |
191
|
|
|
) { |
192
|
|
|
$oldPage = $fb->get('/' . $this->game->getFbPageId() . '?fields=access_token,name,id') |
193
|
|
|
->getGraphNode() |
194
|
|
|
->asArray(); |
195
|
|
|
$removePost = $fb->delete( |
|
|
|
|
196
|
|
|
'/' . $this->game->getFbPostId(), |
197
|
|
|
[], |
198
|
|
|
$oldPage['access_token'] |
199
|
|
|
) |
200
|
|
|
->getGraphNode() |
201
|
|
|
->asArray(); |
202
|
|
|
} |
203
|
|
|
} |
204
|
|
|
} |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
$viewModel = new ViewModel(); |
208
|
|
|
$viewModel->setTemplate($templatePath); |
209
|
|
|
|
210
|
|
|
$gameForm = new ViewModel(); |
211
|
|
|
$gameForm->setTemplate('playground-game/game/game-form'); |
212
|
|
|
|
213
|
|
|
$form = $this->getServiceLocator()->get($formId); |
214
|
|
|
$form->setAttribute( |
215
|
|
|
'action', |
216
|
|
|
$this->adminUrl()->fromRoute( |
|
|
|
|
217
|
|
|
'playgroundgame/edit-' . $this->game->getClassType(), |
218
|
|
|
array('gameId' => $this->game->getId()) |
219
|
|
|
) |
220
|
|
|
); |
221
|
|
|
$form->setAttribute('method', 'post'); |
222
|
|
|
|
223
|
|
|
$pageIds = $form->get('fbPageId')->getOption('value_options'); |
224
|
|
|
foreach ($appsArray as $k => $v) { |
225
|
|
|
$pageIds[$k] = $v; |
226
|
|
|
} |
227
|
|
|
$form->get('fbPageId')->setAttribute('options', $pageIds); |
228
|
|
|
|
229
|
|
|
//if($form->get('fbAppId')->getValue() == '') { |
230
|
|
|
$form->get('fbAppId')->setValue($platformFbAppId); |
231
|
|
|
//} |
232
|
|
|
|
233
|
|
|
// if ($this->game->getFbAppId()) { |
234
|
|
|
// $data['fbAppId'] = $form->get('fbAppId')->getOption('value_options'); |
235
|
|
|
// $appIds[$this->game->getFbAppId()] = $this->game->getFbAppId(); |
236
|
|
|
// $form->get('fbAppId')->setAttribute('options', $appIds); |
237
|
|
|
// } |
238
|
|
|
|
239
|
|
|
$gameOptions = $this->getAdminGameService()->getOptions(); |
240
|
|
|
$gameStylesheet = $gameOptions->getMediaPath() . '/' . 'stylesheet_'. $this->game->getId(). '.css'; |
241
|
|
View Code Duplication |
if (is_file($gameStylesheet)) { |
|
|
|
|
242
|
|
|
$values = $form->get('stylesheet')->getValueOptions(); |
243
|
|
|
$values[$gameStylesheet] = 'Style personnalisé de ce jeu'; |
244
|
|
|
|
245
|
|
|
$form->get('stylesheet')->setAttribute('options', $values); |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
$form->bind($this->game); |
249
|
|
|
|
250
|
|
|
if ($this->getRequest()->isPost()) { |
|
|
|
|
251
|
|
|
$data = array_replace_recursive( |
252
|
|
|
$this->getRequest()->getPost()->toArray(), |
|
|
|
|
253
|
|
|
$this->getRequest()->getFiles()->toArray() |
|
|
|
|
254
|
|
|
); |
255
|
|
|
if (empty($data['prizes'])) { |
256
|
|
|
$data['prizes'] = array(); |
257
|
|
|
} |
258
|
|
|
if (isset($data['drawDate']) && $data['drawDate']) { |
259
|
|
|
$data['drawDate'] = \DateTime::createFromFormat('d/m/Y', $data['drawDate']); |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
$game = $this->getAdminGameService()->createOrUpdate($data, $this->game, $formId); |
263
|
|
|
|
264
|
|
|
if ($game) { |
265
|
|
|
if ($session->offsetExists('fb_token')) { |
266
|
|
|
if (!empty($data['fbPageId']) && !empty($data['fbAppId'])) { |
267
|
|
|
$page = $fb->get('/' . $data['fbPageId'] . '?fields=access_token,name,id') |
268
|
|
|
->getGraphNode() |
269
|
|
|
->asArray(); |
270
|
|
|
|
271
|
|
|
// let's create a post on FB |
272
|
|
|
if ($data['broadcastPostFacebook'] && $game->getWelcomeBlock() != '' && $game->getMainImage() != '') { |
273
|
|
|
$imgPath = $this->url()->fromRoute('frontend', [], ['force_canonical' => true], false).$game->getMainImage(); |
274
|
|
|
// emoticons : $emoji = html_entity_decode('😈'); |
275
|
|
|
|
276
|
|
|
$message = str_replace('<p>', "", $game->getWelcomeBlock()); |
277
|
|
|
$message = str_replace('</p>', "\n", $message); |
278
|
|
|
$message = strip_tags($message); |
279
|
|
|
|
280
|
|
|
// Create the post |
281
|
|
|
try { |
282
|
|
|
// Associate the fbAppId to the page so that we can receive the webhooks |
283
|
|
|
$linkAppToPage = $fb->post( |
|
|
|
|
284
|
|
|
'/' . $page['id'] . '/subscribed_apps', |
285
|
|
|
array(), |
286
|
|
|
$page['access_token'] |
287
|
|
|
); |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* post text and save the post_id to be able to get the likes and comments on the post |
291
|
|
|
*/ |
292
|
|
|
// $post = $fb->post( |
293
|
|
|
// '/' . $page['id'] . '/feed', |
294
|
|
|
// array( |
295
|
|
|
// 'message' => 'message', |
296
|
|
|
// ), |
297
|
|
|
// $page['access_token'] |
298
|
|
|
// ); |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* Post a photo |
302
|
|
|
*/ |
303
|
|
|
// $post = $fb->post( |
304
|
|
|
// '/' . $page['id'] . '/photos', |
305
|
|
|
// array( |
306
|
|
|
// 'url' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
307
|
|
|
// 'published' => true, |
308
|
|
|
// ), |
309
|
|
|
// $page['access_token'] |
310
|
|
|
// ); |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Upload an unpublished photo and include it in a post |
314
|
|
|
*/ |
315
|
|
|
$img = $fb->post( |
316
|
|
|
'/' . $page['id'] . '/photos', |
317
|
|
|
array( |
318
|
|
|
'url' => $imgPath, |
319
|
|
|
'published' => false, |
320
|
|
|
), |
321
|
|
|
$page['access_token'] |
322
|
|
|
); |
323
|
|
|
$img = $img->getGraphNode()->asArray(); |
324
|
|
|
|
325
|
|
|
if ($game->getFbPostId() != '') { |
326
|
|
|
$post = $fb->post( |
327
|
|
|
'/' . $game->getFbPostId(), |
328
|
|
|
array( |
329
|
|
|
'message' => $message, |
330
|
|
|
'attached_media[0]' => '{"media_fbid":"'.$img['id'].'"}', |
331
|
|
|
), |
332
|
|
|
$page['access_token'] |
333
|
|
|
); |
334
|
|
|
} else { |
335
|
|
|
$post = $fb->post( |
336
|
|
|
'/' . $page['id'] . '/feed', |
337
|
|
|
array( |
338
|
|
|
'message' => $message, |
339
|
|
|
'attached_media[0]' => '{"media_fbid":"'.$img['id'].'"}', |
340
|
|
|
), |
341
|
|
|
$page['access_token'] |
342
|
|
|
); |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* Upload an unpublished photo and include it in a scheduled post |
347
|
|
|
*/ |
348
|
|
|
// $img = $fb->post( |
349
|
|
|
// '/' . $page['id'] . '/photos', |
350
|
|
|
// array( |
351
|
|
|
// 'url' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
352
|
|
|
// 'published' => false, |
353
|
|
|
// 'temporary' => true |
354
|
|
|
// ), |
355
|
|
|
// $page['access_token'] |
356
|
|
|
// ); |
357
|
|
|
// $img = $img->getGraphNode()->asArray(); |
358
|
|
|
// |
359
|
|
|
// $post = $fb->post( |
360
|
|
|
// '/' . $page['id'] . '/feed', |
361
|
|
|
// array( |
362
|
|
|
// 'message' => 'message avec image', |
363
|
|
|
// 'attached_media[0]' => '{"media_fbid":"'.$img['id'].'"}', |
364
|
|
|
// 'published' => false, |
365
|
|
|
// 'scheduled_publish_time' => '1512068400', |
366
|
|
|
// 'unpublished_content_type' => 'SCHEDULED', |
367
|
|
|
// ), |
368
|
|
|
// $page['access_token'] |
369
|
|
|
// ); |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* publish multiple photos then associate these photos to a post |
373
|
|
|
*/ |
374
|
|
|
// $endpoint = "/".$page['id']."/photos"; |
375
|
|
|
// $multiple_photos = [ |
376
|
|
|
// 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
377
|
|
|
// 'https://images.unsplash.com/photo-1538218952949-2f5dda4a9156?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=b79a9c7314dd5ca8eac2f187902ceca2&auto=format&fit=crop&w=2704&q=80', |
378
|
|
|
// 'https://images.unsplash.com/photo-1538157245064-badfdabb7142?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=dfa50d5dd51b85f25ca03f2b2667752a&auto=format&fit=crop&w=2700&q=80', |
379
|
|
|
// ]; |
380
|
|
|
// $photos = []; |
381
|
|
|
// $data_post = ['attached_media' => [], 'message' => 'message', 'published' => true]; |
382
|
|
|
// foreach ($multiple_photos as $file_url): |
383
|
|
|
// array_push($photos, $fb->request('POST',$endpoint,['url' =>$file_url,'published' => false,'temporary' => true], $page['access_token'])); |
384
|
|
|
// endforeach; |
385
|
|
|
// $uploaded_photos = $fb->sendBatchRequest($photos, $page['access_token']); |
386
|
|
|
// $uploaded_photos = $uploaded_photos->getGraphNode()->asArray(); |
387
|
|
|
|
388
|
|
|
// foreach ($uploaded_photos as $photo): |
389
|
|
|
// $photo = json_decode($photo['body']); |
390
|
|
|
// array_push($data_post['attached_media'], '{"media_fbid":"'.$photo->id.'"}'); |
391
|
|
|
// endforeach; |
392
|
|
|
// $post = $fb->sendRequest('POST', "/".$page['id']."/feed", $data_post, $page['access_token']); |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* publish a carrousel to a post |
396
|
|
|
*/ |
397
|
|
|
// $data_post = [ |
398
|
|
|
// 'child_attachments' => [], |
399
|
|
|
// 'message' => 'message', |
400
|
|
|
// 'link' => 'https://www.playground.gg', |
401
|
|
|
// 'multi_share_end_card' => false, |
402
|
|
|
// 'published' => true, |
403
|
|
|
// ]; |
404
|
|
|
|
405
|
|
|
// $multiple_photos = [ |
406
|
|
|
// 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
407
|
|
|
// 'https://images.unsplash.com/photo-1538218952949-2f5dda4a9156?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=b79a9c7314dd5ca8eac2f187902ceca2&auto=format&fit=crop&w=2704&q=80', |
408
|
|
|
// 'https://images.unsplash.com/photo-1538157245064-badfdabb7142?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=dfa50d5dd51b85f25ca03f2b2667752a&auto=format&fit=crop&w=2700&q=80', |
409
|
|
|
// ]; |
410
|
|
|
// foreach ($multiple_photos as $k => $photo): |
411
|
|
|
// array_push($data_post['child_attachments'], '{"link":"'.$photo.'", "name": "message_'.$k.'"}'); |
412
|
|
|
// endforeach; |
413
|
|
|
// $post = $fb->sendRequest('POST', "/".$page['id']."/feed", $data_post, $page['access_token']); |
414
|
|
|
|
415
|
|
|
/** Texte avec lien vers une page |
416
|
|
|
* |
417
|
|
|
*/ |
418
|
|
|
// $post = $fb->post( |
419
|
|
|
// '/' . $page['id'] . '/feed', |
420
|
|
|
// array( |
421
|
|
|
// 'message' => 'message', |
422
|
|
|
// 'link' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
423
|
|
|
// //'picture' => 'https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80', |
424
|
|
|
// 'call_to_action' => '{"type":"BOOK_TRAVEL","value":{"link":"https://images.unsplash.com/photo-1538239010247-383da61e35db?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=22e9de10cd7e4d8e32d698099dc6d23c&auto=format&fit=crop&w=3289&q=80"}}', |
425
|
|
|
// ), |
426
|
|
|
// $page['access_token'] |
427
|
|
|
// ); |
428
|
|
|
} catch (\Exception $e) { |
429
|
|
|
if ($e->getMessage() == 'Missing or invalid image file') { |
430
|
|
|
if ($game->getFbPostId() != '') { |
431
|
|
|
$post = $fb->post( |
432
|
|
|
'/' . $game->getFbPostId(), |
433
|
|
|
array( |
434
|
|
|
'message' => $message, |
435
|
|
|
), |
436
|
|
|
$page['access_token'] |
437
|
|
|
); |
438
|
|
|
} else { |
439
|
|
|
$post = $fb->post( |
440
|
|
|
'/' . $page['id'] . '/feed', |
441
|
|
|
array( |
442
|
|
|
'message' => $message, |
443
|
|
|
), |
444
|
|
|
$page['access_token'] |
445
|
|
|
); |
446
|
|
|
} |
447
|
|
|
} else { |
448
|
|
|
throw $e; |
449
|
|
|
} |
450
|
|
|
} |
451
|
|
|
$post = $post->getGraphNode()->asArray(); |
452
|
|
|
if (isset($post['id'])) { |
453
|
|
|
$game->setFbPostId($post['id']); |
454
|
|
|
$game = $this->getAdminGameService()->getGameMapper()->update($game); |
455
|
|
|
} |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
// Let's record the FB page tab if it is configured |
459
|
|
|
// adding page tab to selected page using page access token |
460
|
|
|
if ($data['broadcastFacebook']) { |
461
|
|
|
try { |
462
|
|
|
$addTab = $fb->post( |
|
|
|
|
463
|
|
|
'/' . $page['id'] . '/tabs', |
464
|
|
|
[ |
465
|
|
|
'app_id' => $data['fbAppId'], |
466
|
|
|
'custom_name' => (!empty($data['fbPageTabTitle'])) ? $data['fbPageTabTitle'] : $data['title'], |
467
|
|
|
'custom_image_url' => ($game->getFbPageTabImage() !== '') ? |
468
|
|
|
$this->getAdminGameService()->getServiceManager()->get('ViewRenderer')->url( |
469
|
|
|
'frontend', |
470
|
|
|
array(), |
471
|
|
|
array('force_canonical' => true) |
472
|
|
|
).$game->getFbPageTabImage() : |
473
|
|
|
null, |
474
|
|
|
'position' => (!empty($data['fbPageTabPosition'])) ? $data['fbPageTabPosition'] : 99 |
475
|
|
|
], |
476
|
|
|
$page['access_token'] |
477
|
|
|
) |
478
|
|
|
->getGraphNode() |
479
|
|
|
->asArray(); |
480
|
|
|
} catch (\Exception $e) { |
481
|
|
|
// (#324) Missing or invalid image file |
482
|
|
|
if ($e->getCode() == '324') { |
483
|
|
|
try { |
484
|
|
|
$addTab = $fb->post( |
|
|
|
|
485
|
|
|
'/' . $page['id'] . '/tabs', |
486
|
|
|
[ |
487
|
|
|
'app_id' => $data['fbAppId'], |
488
|
|
|
'custom_name' => (!empty($data['fbPageTabTitle'])) ? $data['fbPageTabTitle'] : $data['title'], |
489
|
|
|
'position' => (!empty($data['fbPageTabPosition'])) ? $data['fbPageTabPosition'] : 99 |
490
|
|
|
], |
491
|
|
|
$page['access_token'] |
492
|
|
|
) |
493
|
|
|
->getGraphNode() |
494
|
|
|
->asArray(); |
495
|
|
|
} catch (\Exception $e) { |
496
|
|
|
throw $e; |
497
|
|
|
} |
498
|
|
|
} |
499
|
|
|
} |
500
|
|
|
} |
501
|
|
|
} |
502
|
|
|
} |
503
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
|
|
|
504
|
|
|
} |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
$gameForm->setVariables( |
508
|
|
|
array( |
509
|
|
|
'platform_fb_app_id' => $platformFbAppId, |
510
|
|
|
'fb_login_url' => $fb_login_url, |
511
|
|
|
'form' => $form, |
512
|
|
|
'game' => $this->game |
513
|
|
|
) |
514
|
|
|
); |
515
|
|
|
$viewModel->addChild($gameForm, 'game_form'); |
516
|
|
|
|
517
|
|
|
return $viewModel->setVariables( |
518
|
|
|
array( |
519
|
|
|
'form' => $form, |
520
|
|
|
'title' => 'Edit this game', |
521
|
|
|
) |
522
|
|
|
); |
523
|
|
|
} |
524
|
|
|
|
525
|
|
|
public function listAction() |
526
|
|
|
{ |
527
|
|
|
// We try to get FB pages from the logged in user |
528
|
|
|
$session = new Container('facebook'); |
529
|
|
|
$config = $this->getServiceLocator()->get('config'); |
530
|
|
|
|
531
|
|
|
if (isset($config['facebook'])) { |
532
|
|
|
$platformFbAppId = $config['facebook']['fb_appid']; |
533
|
|
|
$platformFbAppSecret = $config['facebook']['fb_secret']; |
534
|
|
|
$fb = new \Facebook\Facebook([ |
535
|
|
|
'app_id' => $platformFbAppId, |
536
|
|
|
'app_secret' => $platformFbAppSecret, |
537
|
|
|
'default_graph_version' => 'v3.1', |
538
|
|
|
]); |
539
|
|
|
|
540
|
|
|
$helper = $fb->getRedirectLoginHelper(); |
541
|
|
|
$accessToken = $helper->getAccessToken(); |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
if (isset($accessToken) || $session->offsetExists('fb_token')) { |
545
|
|
|
if (isset($accessToken)) { |
546
|
|
|
$session->offsetSet('fb_token', $accessToken); |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
// checking if user access token is not valid then ask user to login again |
550
|
|
|
$debugToken = $fb->get('/debug_token?input_token='. $session->offsetGet('fb_token'), $platformFbAppId . '|' . $platformFbAppSecret) |
|
|
|
|
551
|
|
|
->getGraphNode() |
552
|
|
|
->asArray(); |
553
|
|
|
if (isset($debugToken['error']['code'])) { |
554
|
|
|
$session->offsetUnset('fb_token'); |
555
|
|
|
} else { |
556
|
|
|
// setting default user access token for future requests |
557
|
|
|
$fb->setDefaultAccessToken($session->offsetGet('fb_token')); |
558
|
|
|
} |
559
|
|
|
} |
560
|
|
|
$filter = $this->getEvent()->getRouteMatch()->getParam('filter'); |
561
|
|
|
$type = $this->getEvent()->getRouteMatch()->getParam('type'); |
562
|
|
|
|
563
|
|
|
$service = $this->getAdminGameService(); |
564
|
|
|
$adapter = new DoctrineAdapter(new ORMPaginator($service->getQueryGamesOrderBy($type, $filter))); |
565
|
|
|
$paginator = new Paginator($adapter); |
566
|
|
|
$paginator->setItemCountPerPage(25); |
567
|
|
|
$paginator->setCurrentPageNumber($this->getEvent()->getRouteMatch()->getParam('p')); |
568
|
|
|
|
569
|
|
|
foreach ($paginator as $game) { |
570
|
|
|
$game->entry = $service->getEntryMapper()->countByGame($game); |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
return array( |
574
|
|
|
'games' => $paginator, |
575
|
|
|
'type' => $type, |
576
|
|
|
'filter' => $filter, |
577
|
|
|
); |
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
public function entryAction() |
581
|
|
|
{ |
582
|
|
|
$this->checkGame(); |
583
|
|
|
|
584
|
|
|
$qb = $this->getAdminGameService()->getEntriesQuery($this->game); |
585
|
|
|
// $query = $qb->getQuery(); |
586
|
|
|
// $adapter = new DoctrineAdapter(new LargeTablePaginator($query)); |
587
|
|
|
// $paginator = new Paginator($adapter); |
588
|
|
|
// $paginator->setItemCountPerPage(50); |
589
|
|
|
// $paginator->setCurrentPageNumber($this->getEvent()->getRouteMatch()->getParam('p')); |
590
|
|
|
|
591
|
|
|
// $header = $this->getAdminGameService()->getEntriesHeader($this->game); |
592
|
|
|
// $entries = $this->getAdminGameService()->getGameEntries($header, $paginator, $this->game); |
593
|
|
|
|
594
|
|
|
// return array( |
595
|
|
|
// 'paginator' => $paginator, |
596
|
|
|
// 'entries' => $entries, |
597
|
|
|
// 'header' => $header, |
598
|
|
|
// 'game' => $this->game, |
599
|
|
|
// 'gameId' => $this->game->getId() |
600
|
|
|
// ); |
601
|
|
|
|
602
|
|
|
/* @var $grid \ZfcDatagrid\Datagrid */ |
603
|
|
|
$grid = $this->getServiceLocator()->get('ZfcDatagrid\Datagrid'); |
604
|
|
|
$grid->setTitle('Entries'); |
605
|
|
|
$grid->setDataSource($qb); |
606
|
|
|
|
607
|
|
|
$col = new Column\Select('id', 'u'); |
608
|
|
|
$col->setLabel('Id'); |
609
|
|
|
$col->setIdentity(true); |
610
|
|
|
$grid->addColumn($col); |
611
|
|
|
|
612
|
|
|
$colType = new Type\DateTime( |
613
|
|
|
'Y-m-d H:i:s', |
614
|
|
|
\IntlDateFormatter::MEDIUM, |
615
|
|
|
\IntlDateFormatter::MEDIUM |
616
|
|
|
); |
617
|
|
|
$colType->setSourceTimezone('UTC'); |
618
|
|
|
|
619
|
|
|
$col = new Column\Select('created_at', 'u'); |
620
|
|
|
$col->setLabel('Created'); |
621
|
|
|
$col->setType($colType); |
622
|
|
|
$grid->addColumn($col); |
623
|
|
|
|
624
|
|
|
$col = new Column\Select('username', 'u'); |
625
|
|
|
$col->setLabel('Username'); |
626
|
|
|
$grid->addColumn($col); |
627
|
|
|
|
628
|
|
|
$col = new Column\Select('email', 'u'); |
629
|
|
|
$col->setLabel('Email'); |
630
|
|
|
$grid->addColumn($col); |
631
|
|
|
|
632
|
|
|
$col = new Column\Select('firstname', 'u'); |
633
|
|
|
$col->setLabel('Firstname'); |
634
|
|
|
$grid->addColumn($col); |
635
|
|
|
|
636
|
|
|
$col = new Column\Select('lastname', 'u'); |
637
|
|
|
$col->setLabel('Lastname'); |
638
|
|
|
$grid->addColumn($col); |
639
|
|
|
|
640
|
|
|
$col = new Column\Select('winner', 'e'); |
641
|
|
|
$col->setLabel('Status'); |
642
|
|
|
$col->setReplaceValues( |
643
|
|
|
[ |
644
|
|
|
0 => 'looser', |
645
|
|
|
1 => 'winner', |
646
|
|
|
] |
647
|
|
|
); |
648
|
|
|
$grid->addColumn($col); |
649
|
|
|
|
650
|
|
|
// $actions = new Column\Action(); |
651
|
|
|
// $actions->setLabel(''); |
652
|
|
|
|
653
|
|
|
// $viewAction = new Column\Action\Button(); |
654
|
|
|
// $viewAction->setLabel('Reset Password'); |
655
|
|
|
// $rowId = $viewAction->getRowIdPlaceholder(); |
656
|
|
|
// $viewAction->setLink('/admin/user/reset/'.$rowId); |
657
|
|
|
// $actions->addAction($viewAction); |
658
|
|
|
|
659
|
|
|
// $grid->addColumn($actions); |
660
|
|
|
|
661
|
|
|
// $action = new Action\Mass(); |
662
|
|
|
// $action->setTitle('This is incredible'); |
663
|
|
|
// $action->setLink('/test'); |
664
|
|
|
// $action->setConfirm(true); |
665
|
|
|
// $grid->addMassAction($action); |
666
|
|
|
|
667
|
|
|
$grid->render(); |
668
|
|
|
|
669
|
|
|
return $grid->getResponse(); |
670
|
|
|
} |
671
|
|
|
|
672
|
|
View Code Duplication |
public function invitationAction() |
|
|
|
|
673
|
|
|
{ |
674
|
|
|
$this->checkGame(); |
675
|
|
|
|
676
|
|
|
$adapter = new DoctrineAdapter( |
677
|
|
|
new LargeTablePaginator( |
678
|
|
|
$this->getAdminGameService()->getInvitationMapper()->queryByGame($this->game) |
679
|
|
|
) |
680
|
|
|
); |
681
|
|
|
$paginator = new Paginator($adapter); |
682
|
|
|
$paginator->setItemCountPerPage(25); |
683
|
|
|
$paginator->setCurrentPageNumber($this->getEvent()->getRouteMatch()->getParam('p')); |
684
|
|
|
|
685
|
|
|
return new ViewModel( |
686
|
|
|
array( |
687
|
|
|
'invitations' => $paginator, |
688
|
|
|
'gameId' => $this->game->getId(), |
689
|
|
|
'game' => $this->game, |
690
|
|
|
) |
691
|
|
|
); |
692
|
|
|
} |
693
|
|
|
|
694
|
|
|
public function removeInvitationAction() |
695
|
|
|
{ |
696
|
|
|
$this->checkGame(); |
697
|
|
|
|
698
|
|
|
$service = $this->getAdminGameService(); |
699
|
|
|
$invitationId = $this->getEvent()->getRouteMatch()->getParam('invitationId'); |
700
|
|
|
if ($invitationId) { |
701
|
|
|
$invitation = $service->getInvitationMapper()->findById($invitationId); |
702
|
|
|
$service->getInvitationMapper()->remove($invitation); |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute($this->game->getClassType() .'/invitation', array('gameId'=>$this->game->getId()))); |
|
|
|
|
706
|
|
|
} |
707
|
|
|
|
708
|
|
|
public function downloadAction() |
709
|
|
|
{ |
710
|
|
|
$this->checkGame(); |
711
|
|
|
$header = $this->getAdminGameService()->getEntriesHeader($this->game); |
712
|
|
|
$qb = $this->getAdminGameService()->getEntriesQuery($this->game); |
713
|
|
|
$query = $qb->getQuery(); |
714
|
|
|
|
715
|
|
|
$content = "\xEF\xBB\xBF"; // UTF-8 BOM |
716
|
|
|
$content .= $this->getAdminGameService()->getCSV( |
717
|
|
|
$this->getAdminGameService()->getGameEntries( |
718
|
|
|
$header, |
719
|
|
|
$query->getResult(), |
720
|
|
|
$this->game |
721
|
|
|
) |
722
|
|
|
); |
723
|
|
|
|
724
|
|
|
$response = $this->getResponse(); |
725
|
|
|
$headers = $response->getHeaders(); |
726
|
|
|
$headers->addHeaderLine('Content-Encoding: UTF-8'); |
727
|
|
|
$headers->addHeaderLine('Content-Type', 'text/csv; charset=UTF-8'); |
728
|
|
|
$headers->addHeaderLine('Content-Disposition', "attachment; filename=\"entry.csv\""); |
729
|
|
|
$headers->addHeaderLine('Accept-Ranges', 'bytes'); |
730
|
|
|
$headers->addHeaderLine('Content-Length', strlen($content)); |
731
|
|
|
|
732
|
|
|
$response->setContent($content); |
733
|
|
|
|
734
|
|
|
return $response; |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
// Only used for Quiz and Lottery |
738
|
|
|
public function drawAction() |
739
|
|
|
{ |
740
|
|
|
$this->checkGame(); |
741
|
|
|
|
742
|
|
|
$winningEntries = $this->getAdminGameService()->draw($this->game); |
743
|
|
|
|
744
|
|
|
$content = "\xEF\xBB\xBF"; // UTF-8 BOM |
745
|
|
|
$content .= "ID;Pseudo;Nom;Prenom;E-mail;Etat\n"; |
746
|
|
|
|
747
|
|
|
foreach ($winningEntries as $e) { |
748
|
|
|
$etat = 'gagnant'; |
749
|
|
|
|
750
|
|
|
$content .= $e->getUser()->getId() |
751
|
|
|
. ";" . $e->getUser()->getUsername() |
752
|
|
|
. ";" . $e->getUser()->getLastname() |
753
|
|
|
. ";" . $e->getUser()->getFirstname() |
754
|
|
|
. ";" . $e->getUser()->getEmail() |
755
|
|
|
. ";" . $etat |
756
|
|
|
."\n"; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
$response = $this->getResponse(); |
760
|
|
|
$headers = $response->getHeaders(); |
761
|
|
|
$headers->addHeaderLine('Content-Encoding: UTF-8'); |
762
|
|
|
$headers->addHeaderLine('Content-Type', 'text/csv; charset=UTF-8'); |
763
|
|
|
$headers->addHeaderLine('Content-Disposition', "attachment; filename=\"gagnants.csv\""); |
764
|
|
|
$headers->addHeaderLine('Accept-Ranges', 'bytes'); |
765
|
|
|
$headers->addHeaderLine('Content-Length', strlen($content)); |
766
|
|
|
|
767
|
|
|
$response->setContent($content); |
768
|
|
|
|
769
|
|
|
return $response; |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
/** |
773
|
|
|
* This method serialize a game an export it as a txt file |
774
|
|
|
* @return \Zend\Stdlib\ResponseInterface |
775
|
|
|
*/ |
776
|
|
|
public function exportAction() |
777
|
|
|
{ |
778
|
|
|
$this->checkGame(); |
779
|
|
|
$content = serialize($this->game); |
780
|
|
|
|
781
|
|
|
$response = $this->getResponse(); |
782
|
|
|
$headers = $response->getHeaders(); |
783
|
|
|
$headers->addHeaderLine('Content-Encoding: UTF-8'); |
784
|
|
|
$headers->addHeaderLine('Content-Type', 'text/plain; charset=UTF-8'); |
785
|
|
|
$headers->addHeaderLine( |
786
|
|
|
'Content-Disposition', |
787
|
|
|
"attachment; filename=\"". $this->game->getIdentifier() .".txt\"" |
788
|
|
|
); |
789
|
|
|
$headers->addHeaderLine('Accept-Ranges', 'bytes'); |
790
|
|
|
$headers->addHeaderLine('Content-Length', strlen($content)); |
791
|
|
|
|
792
|
|
|
$response->setContent($content); |
793
|
|
|
|
794
|
|
|
return $response; |
795
|
|
|
} |
796
|
|
|
|
797
|
|
|
/** |
798
|
|
|
* This method take an uploaded txt file containing a serialized game |
799
|
|
|
* and persist it in the database |
800
|
|
|
* @return unknown |
801
|
|
|
*/ |
802
|
|
|
public function importAction() |
803
|
|
|
{ |
804
|
|
|
$form = $this->getServiceLocator()->get('playgroundgame_import_form'); |
805
|
|
|
$form->setAttribute('action', $this->adminUrl()->fromRoute('playgroundgame/import')); |
|
|
|
|
806
|
|
|
$form->setAttribute('method', 'post'); |
807
|
|
|
|
808
|
|
|
if ($this->getRequest()->isPost()) { |
|
|
|
|
809
|
|
|
$data = array_replace_recursive( |
810
|
|
|
$this->getRequest()->getPost()->toArray(), |
|
|
|
|
811
|
|
|
$this->getRequest()->getFiles()->toArray() |
|
|
|
|
812
|
|
|
); |
813
|
|
|
|
814
|
|
|
if (! empty($data['import_file']['tmp_name'])) { |
815
|
|
|
ErrorHandler::start(); |
816
|
|
|
$game = unserialize(file_get_contents($data['import_file']['tmp_name'])); |
817
|
|
|
$game->setId(null); |
818
|
|
|
if ($data['slug']) { |
819
|
|
|
$game->setIdentifier($data['slug']); |
820
|
|
|
} |
821
|
|
|
$duplicate = $this->getAdminGameService()->getGameMapper()->findByIdentifier($game->getIdentifier()); |
822
|
|
|
if (!$duplicate) { |
823
|
|
|
$this->getAdminGameService()->getGameMapper()->insert($game); |
824
|
|
|
} |
825
|
|
|
|
826
|
|
|
ErrorHandler::stop(true); |
827
|
|
|
} |
828
|
|
|
|
829
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
|
|
|
830
|
|
|
} |
831
|
|
|
|
832
|
|
|
return array( |
833
|
|
|
'form' => $form, |
834
|
|
|
); |
835
|
|
|
} |
836
|
|
|
|
837
|
|
|
public function removeAction() |
838
|
|
|
{ |
839
|
|
|
$this->checkGame(); |
840
|
|
|
|
841
|
|
|
try { |
842
|
|
|
$this->getAdminGameService()->getGameMapper()->remove($this->game); |
843
|
|
|
$this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The game has been edited'); |
|
|
|
|
844
|
|
|
} catch (\Doctrine\DBAL\DBALException $e) { |
845
|
|
|
$this->flashMessenger()->setNamespace('playgroundgame')->addMessage( |
|
|
|
|
846
|
|
|
'Il y a déjà eu des participants à ce jeu. Vous ne pouvez plus le supprimer' |
847
|
|
|
); |
848
|
|
|
} |
849
|
|
|
|
850
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
|
|
|
851
|
|
|
} |
852
|
|
|
|
853
|
|
|
public function setActiveAction() |
854
|
|
|
{ |
855
|
|
|
$this->checkGame(); |
856
|
|
|
|
857
|
|
|
$this->game->setActive(!$this->game->getActive()); |
858
|
|
|
$this->getAdminGameService()->getGameMapper()->update($this->game); |
859
|
|
|
|
860
|
|
|
return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
|
|
|
861
|
|
|
} |
862
|
|
|
|
863
|
|
|
public function formAction() |
864
|
|
|
{ |
865
|
|
|
$this->checkGame(); |
866
|
|
|
|
867
|
|
|
$form = $this->game->getPlayerForm(); |
868
|
|
|
|
869
|
|
|
return $this->createForm($form); |
870
|
|
|
} |
871
|
|
|
|
872
|
|
|
public function setOptions(ModuleOptions $options) |
873
|
|
|
{ |
874
|
|
|
$this->options = $options; |
875
|
|
|
|
876
|
|
|
return $this; |
877
|
|
|
} |
878
|
|
|
|
879
|
|
|
public function getOptions() |
880
|
|
|
{ |
881
|
|
|
if (!$this->options instanceof ModuleOptions) { |
882
|
|
|
$this->setOptions($this->getServiceLocator()->get('playgroundgame_module_options')); |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
return $this->options; |
886
|
|
|
} |
887
|
|
|
|
888
|
|
|
public function getAdminGameService() |
889
|
|
|
{ |
890
|
|
|
if (!$this->adminGameService) { |
891
|
|
|
$this->adminGameService = $this->getServiceLocator()->get('playgroundgame_game_service'); |
892
|
|
|
} |
893
|
|
|
|
894
|
|
|
return $this->adminGameService; |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
public function setAdminGameService(AdminGameService $adminGameService) |
898
|
|
|
{ |
899
|
|
|
$this->adminGameService = $adminGameService; |
900
|
|
|
|
901
|
|
|
return $this; |
902
|
|
|
} |
903
|
|
|
} |
904
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..