|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PlaygroundGame\Form\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use PlaygroundCore\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator; |
|
6
|
|
|
use Zend\Mvc\I18n\Translator; |
|
7
|
|
|
use Zend\ServiceManager\ServiceManager; |
|
8
|
|
|
|
|
9
|
|
|
class TradingCard extends Game |
|
10
|
|
|
{ |
|
11
|
|
|
public function __construct($name, ServiceManager $sm, Translator $translator) |
|
12
|
|
|
{ |
|
13
|
|
|
$this->setServiceManager($sm); |
|
14
|
|
|
$entityManager = $sm->get('doctrine.entitymanager.orm_default'); |
|
15
|
|
|
|
|
16
|
|
|
// having to fix a Doctrine-module bug :( https://github.com/doctrine/DoctrineModule/issues/180 |
|
17
|
|
|
$hydrator = new DoctrineHydrator($entityManager, 'PlaygroundGame\Entity\TradingCard'); |
|
|
|
|
|
|
18
|
|
|
$hydrator->addStrategy('partner', new \PlaygroundCore\Stdlib\Hydrator\Strategy\ObjectStrategy()); |
|
19
|
|
|
$this->setHydrator($hydrator); |
|
20
|
|
|
|
|
21
|
|
|
parent::__construct($name, $sm, $translator); |
|
22
|
|
|
|
|
23
|
|
|
$this->add(array( |
|
24
|
|
|
'name' => 'boosterCardNumber', |
|
25
|
|
|
'type' => 'Zend\Form\Element\Text', |
|
26
|
|
|
'attributes' => array( |
|
27
|
|
|
'placeholder' => $translator->translate('Number of cards in booster', 'playgroundgame'), |
|
28
|
|
|
), |
|
29
|
|
|
'options' => array( |
|
30
|
|
|
'label' => $translator->translate('Number of cards in booster', 'playgroundgame'), |
|
31
|
|
|
), |
|
32
|
|
|
)); |
|
33
|
|
|
|
|
34
|
|
|
$this->add(array( |
|
35
|
|
|
'name' => 'boosterDrawQuantity', |
|
36
|
|
|
'type' => 'Zend\Form\Element\Text', |
|
37
|
|
|
'attributes' => array( |
|
38
|
|
|
'placeholder' => $translator->translate('Number of boosters', 'playgroundgame'), |
|
39
|
|
|
), |
|
40
|
|
|
'options' => array( |
|
41
|
|
|
'label' => $translator->translate('Number of boosters', 'playgroundgame'), |
|
42
|
|
|
), |
|
43
|
|
|
)); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|
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: