|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
* @author [email protected] |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Jobs\Form; |
|
12
|
|
|
|
|
13
|
|
|
use Jobs\Entity\Category; |
|
14
|
|
|
use Zend\Form\Fieldset; |
|
15
|
|
|
use Core\Entity\Hydrator\EntityHydrator; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Fieldset for the category management. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Mathias Gelhausen <[email protected]> |
|
21
|
|
|
* @since 0.29 |
|
22
|
|
|
*/ |
|
23
|
|
|
class ClassificationsFieldset extends Fieldset |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
public function getHydrator() |
|
27
|
|
|
{ |
|
28
|
|
|
if (!$this->hydrator) { |
|
29
|
|
|
$hydrator = new EntityHydrator(); |
|
30
|
|
|
$this->setHydrator($hydrator); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
return $this->hydrator; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function init() |
|
37
|
|
|
{ |
|
38
|
|
|
|
|
39
|
|
|
$this->setName('classifications'); |
|
40
|
|
|
$formElements = $this->getFormFactory()->getFormElementManager(); |
|
41
|
|
|
|
|
42
|
|
|
$professions = $formElements->get( |
|
43
|
|
|
'Core/Tree/Select', |
|
44
|
|
|
[ |
|
45
|
|
|
'tree' => [ |
|
46
|
|
|
'entity' => Category::class, |
|
47
|
|
|
'value' => 'professions', |
|
48
|
|
|
], |
|
49
|
|
|
'allow_select_nodes' => true, |
|
50
|
|
|
'name' => 'professions', |
|
51
|
|
|
'options' => [ |
|
52
|
|
|
'label' => /*@translate*/ 'Professions', |
|
53
|
|
|
], |
|
54
|
|
|
'attributes' => [ |
|
55
|
|
|
'data-width' => '100%', |
|
56
|
|
|
'multiple' => true, |
|
57
|
|
|
], |
|
58
|
|
|
] |
|
59
|
|
|
); |
|
60
|
|
|
$this->add($professions); |
|
61
|
|
|
|
|
62
|
|
|
$types = $formElements->get( |
|
63
|
|
|
'Core/Tree/Select', |
|
64
|
|
|
[ |
|
65
|
|
|
'tree' => [ |
|
66
|
|
|
'entity' => Category::class, |
|
67
|
|
|
'value' => 'employmentTypes', |
|
68
|
|
|
], |
|
69
|
|
|
'name' => 'employmentTypes', |
|
70
|
|
|
'options' => [ |
|
71
|
|
|
'label' => /*@translate*/ 'Employment Types', |
|
72
|
|
|
], |
|
73
|
|
|
'attributes' => [ |
|
74
|
|
|
'data-width' => '100%', |
|
75
|
|
|
//'multiple' => true, |
|
|
|
|
|
|
76
|
|
|
] |
|
77
|
|
|
] |
|
78
|
|
|
); |
|
79
|
|
|
$this->add($types); |
|
80
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
$hydrator = $this->getHydrator(); |
|
83
|
|
|
$hydrator->addStrategy('professions', $professions->getHydratorStrategy()); |
|
84
|
|
|
$hydrator->addStrategy('employmentTypes', $types->getHydratorStrategy()); |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.