1 | <?php |
||
23 | class EntityUpdateService extends AbstractEntityService implements |
||
24 | EntityServiceInterface |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $data = []; |
||
31 | |||
32 | /** |
||
33 | * @var Entity |
||
34 | */ |
||
35 | protected $entity; |
||
36 | |||
37 | /** |
||
38 | * @var EntityForm |
||
39 | */ |
||
40 | protected $form; |
||
41 | |||
42 | /** |
||
43 | * Entity Update Service need an entity. |
||
44 | * |
||
45 | * @param Entity $entity |
||
46 | */ |
||
47 | 6 | public function __construct(Entity $entity) |
|
51 | |||
52 | /** |
||
53 | * Updates entity with provided data |
||
54 | */ |
||
55 | 2 | public function update() |
|
59 | |||
60 | /** |
||
61 | * Get current data to be updated |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | 4 | public function getData() |
|
69 | |||
70 | /** |
||
71 | * Set data for entity update |
||
72 | * |
||
73 | * @param array $data |
||
74 | * |
||
75 | * @return EntityUpdateService |
||
76 | */ |
||
77 | 2 | public function setData(array $data) |
|
82 | |||
83 | /** |
||
84 | * Get entity for |
||
85 | * |
||
86 | * @return EntityForm |
||
87 | */ |
||
88 | 2 | public function getForm() |
|
92 | |||
93 | /** |
||
94 | * Set entity for |
||
95 | * |
||
96 | * @param EntityForm $form |
||
97 | * |
||
98 | * @return EntityUpdateService |
||
99 | * |
||
100 | * @throws InvalidFormDataException If the provided form has invalid data |
||
101 | */ |
||
102 | 4 | public function setForm(EntityForm $form) |
|
113 | |||
114 | } |