Completed
Push — develop ( 6adcbb...6abf52 )
by
unknown
10:12
created

OrganizationsContactFieldset::allowObjectBinding()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 * @author    Mathias Weitz <[email protected]>
9
 */
10
11
namespace Organizations\Form;
12
13
use Zend\Form\Fieldset;
14
use Core\Entity\Hydrator\EntityHydrator;
15
use Organizations\Entity\OrganizationContact;
16
17
/**
18
 * Class ContactFieldset
19
 * @package Organizations\Form
20
 */
21
class OrganizationsContactFieldset extends Fieldset
22
{
23
24
    public function getHydrator()
25
    {
26
        if (!$this->hydrator) {
27
            $hydrator           = new EntityHydrator();
28
            $this->setHydrator($hydrator);
29
        }
30
        return $this->hydrator;
31
    }
32
33
34
    /**
35
     * set the elements for the form
36
     */
37
    public function init()
38
    {
39
        $this->setName('contact');
40
        
41
        $this->add(
42
            array(
43
                'name' => 'street',
44
                'options' => array(
45
                        'label' => /* @translate */ 'street'
46
                )
47
            )
48
        );
49
        
50
        $this->add(
51
            array(
52
                'name' => 'houseNumber',
53
                'options' => array(
54
                        'label' => /* @translate */ 'house number'
55
                )
56
            )
57
        );
58
        
59
        $this->add(
60
            array(
61
                'name' => 'postalcode',
62
                'options' => array(
63
                        'label' => /* @translate */ 'Postalcode'
64
                )
65
            )
66
        );
67
        
68
        $this->add(
69
            array(
70
                'name' => 'city',
71
                'options' => array(
72
                        'label' => /* @translate */ 'City'
73
                )
74
            )
75
        );
76
        $this->add(
77
            array(
78
                'name' => 'phone',
79
                'options' => array(
80
                    'label' => /* @translate */ 'Phone'
81
                )
82
            )
83
        );
84
        $this->add(
85
            array(
86
                'name' => 'fax',
87
                'options' => array(
88
                    'label' => /* @translate */ 'Fax'
89
                )
90
            )
91
        );
92
93
    }
94
95
    /**
96
     * for later use - all the mandatory fields
97
     * @return array
98
     */
99
    public function getInputFilterSpecification()
100
    {
101
        return array();
102
    }
103
104
    /**
105
     * a required method to overwrite the generic method to make the binding of the entity work
106
     * @param object $object
107
     * @return bool
108
     */
109
    public function allowObjectBinding($object)
110
    {
111
        return $object instanceof OrganizationContact;
112
    }
113
}
114