|
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 Memory 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\Memory'); |
|
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' => 'victoryConditions', |
|
25
|
|
|
'type' => 'Zend\Form\Element\Text', |
|
26
|
|
|
'attributes' => array( |
|
27
|
|
|
'placeholder' => $translator->translate('% good picks vs mistakes', 'playgroundgame'), |
|
28
|
|
|
'id' => 'victoryConditions', |
|
29
|
|
|
), |
|
30
|
|
|
'options' => array( |
|
31
|
|
|
'label' => $translator->translate('Victory conditions', 'playgroundgame'), |
|
32
|
|
|
), |
|
33
|
|
|
)); |
|
34
|
|
|
|
|
35
|
|
|
// Adding an empty upload field to be able to correctly handle this on |
|
36
|
|
|
// the service side. |
|
37
|
|
|
$this->add(array( |
|
38
|
|
|
'name' => 'uploadBackImage', |
|
39
|
|
|
'attributes' => array( |
|
40
|
|
|
'type' => 'file', |
|
41
|
|
|
), |
|
42
|
|
|
'options' => array( |
|
43
|
|
|
'label' => $translator->translate('Back card image', 'playgroundgame'), |
|
44
|
|
|
), |
|
45
|
|
|
)); |
|
46
|
|
|
$this->add(array( |
|
47
|
|
|
'name' => 'backImage', |
|
48
|
|
|
'type' => 'Zend\Form\Element\Hidden', |
|
49
|
|
|
'attributes' => array( |
|
50
|
|
|
'value' => '', |
|
51
|
|
|
), |
|
52
|
|
|
)); |
|
53
|
|
|
$this->add(array( |
|
54
|
|
|
'name' => 'deleteBackImage', |
|
55
|
|
|
'type' => 'Zend\Form\Element\Hidden', |
|
56
|
|
|
'attributes' => array( |
|
57
|
|
|
'value' => '', |
|
58
|
|
|
'class' => 'delete_scratch_image', |
|
59
|
|
|
), |
|
60
|
|
|
)); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|