|
1
|
|
|
<?php |
|
2
|
|
|
namespace OmnideskBundle\DataTransformer\Request\Cases; |
|
3
|
|
|
|
|
4
|
|
|
use OmnideskBundle\DataTransformer\DataTransformerInterface; |
|
5
|
|
|
use OmnideskBundle\Model\Cases; |
|
6
|
|
|
use OmnideskBundle\Request\Cases\AddCasesRequest; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class AddCasesRequestDataTransformer |
|
10
|
|
|
* @package OmnideskBundle\DataTransformer\Request |
|
11
|
|
|
*/ |
|
12
|
|
|
class AddCasesRequestDataTransformer implements DataTransformerInterface |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @param AddCasesRequest $value |
|
16
|
|
|
* @return array |
|
17
|
|
|
*/ |
|
18
|
|
|
public function transform($value) |
|
19
|
|
|
{ |
|
20
|
|
|
$attachments = []; |
|
21
|
|
|
foreach ($value->getAttachments() as $attachment) { |
|
22
|
|
|
$attachments[] = $attachment->getRealPath(); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
return [ |
|
26
|
|
|
'user_email' => $value->getUserEmail(), |
|
27
|
|
|
'user_phone' => $value->getUserPhone(), |
|
28
|
|
|
'user_full_name' => $value->getUserFullName(), |
|
29
|
|
|
'subject' => $value->getSubject(), |
|
30
|
|
|
'content' => $value->getContent(), |
|
31
|
|
|
'content_html' => $value->getContentHtml(), |
|
32
|
|
|
'group_id' => $value->getGroupId(), |
|
33
|
|
|
'language_id' => $value->getLanguageId(), |
|
34
|
|
|
'custom_fields' => $value->getCustomFields(), |
|
35
|
|
|
'labels' => $value->getLabels(), |
|
36
|
|
|
'attachments' => $attachments, |
|
37
|
|
|
'priority' => $value->getPriority(), |
|
38
|
|
|
'staff_id' => $value->getStaffId(), |
|
39
|
|
|
]; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param array $value |
|
44
|
|
|
* @return AddCasesRequest |
|
45
|
|
|
*/ |
|
46
|
|
|
public function reverseTransform($value) |
|
47
|
|
|
{ |
|
48
|
|
|
throw new \LogicException('Method not implemented.'); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|