1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PlaygroundGame\Form\Admin; |
4
|
|
|
|
5
|
|
|
use PlaygroundGame\Entity\MissionGameCondition; |
6
|
|
|
use Zend\Form\Fieldset; |
7
|
|
|
use Zend\Mvc\I18n\Translator; |
8
|
|
|
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator; |
9
|
|
|
use Zend\ServiceManager\ServiceManager; |
10
|
|
|
|
11
|
|
|
class MissionGameConditionFieldset extends Fieldset |
12
|
|
|
{ |
13
|
|
|
public function __construct($name, ServiceManager $serviceManager, Translator $translator) |
14
|
|
|
{ |
15
|
|
|
parent::__construct($name); |
16
|
|
|
$entityManager = $serviceManager->get('doctrine.entitymanager.orm_default'); |
17
|
|
|
|
18
|
|
|
$this->setHydrator(new DoctrineHydrator($entityManager, 'PlaygroundGame\Entity\MissionGameCondition')) |
|
|
|
|
19
|
|
|
->setObject(new MissionGameCondition()); |
20
|
|
|
|
21
|
|
|
$this->add(array( |
22
|
|
|
'type' => 'Zend\Form\Element\Hidden', |
23
|
|
|
'name' => 'id' |
24
|
|
|
)); |
25
|
|
|
|
26
|
|
|
$this->add(array( |
27
|
|
|
'type' => 'Zend\Form\Element\Select', |
28
|
|
|
'name' => 'attribute', |
29
|
|
|
'options' => array( |
30
|
|
|
'empty_option' => $translator->translate('Select the attribute', 'playgroundgame'), |
31
|
|
|
'value_options' => array( |
32
|
|
|
'winner' => $translator->translate('status of previous game', 'playgroundgame'), |
33
|
|
|
'points' => $translator->translate('Points of previous game', 'playgroundgame'), |
34
|
|
|
), |
35
|
|
|
'label' => $translator->translate('Attribute', 'playgroundgame'), |
36
|
|
|
), |
37
|
|
|
)); |
38
|
|
|
|
39
|
|
|
$this->add(array( |
40
|
|
|
'type' => 'Zend\Form\Element\Select', |
41
|
|
|
'name' => 'comparison', |
42
|
|
|
'options' => array( |
43
|
|
|
'empty_option' => $translator->translate('Type of comparison', 'playgroundgame'), |
44
|
|
|
'value_options' => array( |
45
|
|
|
'==' => $translator->translate('equals', 'playgroundgame'), |
46
|
|
|
'>' => $translator->translate('more than', 'playgroundgame'), |
47
|
|
|
'<' => $translator->translate('less than', 'playgroundgame'), |
48
|
|
|
), |
49
|
|
|
'label' => $translator->translate('Comparison', 'playgroundgame'), |
50
|
|
|
), |
51
|
|
|
)); |
52
|
|
|
|
53
|
|
|
$this->add(array( |
54
|
|
|
'name' => 'value', |
55
|
|
|
'options' => array( |
56
|
|
|
'label' => $translator->translate('Value'), |
57
|
|
|
), |
58
|
|
|
)); |
59
|
|
|
|
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
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: