1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PlaygroundGame\Form\Admin; |
4
|
|
|
|
5
|
|
|
use Zend\Form\Form; |
6
|
|
|
use PlaygroundCore\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator; |
7
|
|
|
use Zend\Form\Element; |
8
|
|
|
use Zend\Mvc\I18n\Translator; |
9
|
|
|
use Zend\ServiceManager\ServiceManager; |
10
|
|
|
use PlaygroundGame\Form\Admin\Game; |
11
|
|
|
|
12
|
|
|
class Mission extends Game |
13
|
|
|
{ |
14
|
|
|
public function __construct($name, ServiceManager $sm, Translator $translator) |
15
|
|
|
{ |
16
|
|
|
$this->setServiceManager($sm); |
17
|
|
|
$entityManager = $sm->get('doctrine.entitymanager.orm_default'); |
18
|
|
|
|
19
|
|
|
// having to fix a Doctrine-module bug :( https://github.com/doctrine/DoctrineModule/issues/180 |
20
|
|
|
$hydrator = new DoctrineHydrator($entityManager, 'PlaygroundGame\Entity\Mission'); |
|
|
|
|
21
|
|
|
$hydrator->addStrategy('partner', new \PlaygroundCore\Stdlib\Hydrator\Strategy\ObjectStrategy()); |
22
|
|
|
$this->setHydrator($hydrator); |
23
|
|
|
|
24
|
|
|
/*$this->setValidationGroup(array( |
25
|
|
|
'MissionGame' => array( |
26
|
|
|
'game' |
27
|
|
|
) |
28
|
|
|
));*/ |
29
|
|
|
|
30
|
|
|
parent::__construct($name, $sm, $translator); |
31
|
|
|
|
32
|
|
|
$gameMissionFieldset = new MissionGameFieldset(null, $sm, $translator); |
33
|
|
|
$this->add(array( |
34
|
|
|
'type' => 'Zend\Form\Element\Collection', |
35
|
|
|
'name' => 'missionGames', |
36
|
|
|
'options' => array( |
37
|
|
|
'id' => 'missionGames', |
38
|
|
|
'label' => $translator->translate('List of games', 'playgroundgame'), |
39
|
|
|
'count' => 0, |
40
|
|
|
'should_create_template' => true, |
41
|
|
|
'allow_add' => true, |
42
|
|
|
'allow_remove' => true, |
43
|
|
|
'target_element' => $gameMissionFieldset |
44
|
|
|
) |
45
|
|
|
)); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: