|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AppBundle\Model; |
|
4
|
|
|
|
|
5
|
|
|
use AppBundle\Entity\Customer; |
|
6
|
|
|
use JMS\Serializer\Annotation\Accessor; |
|
7
|
|
|
use JMS\Serializer\Annotation\ExclusionPolicy; |
|
8
|
|
|
use JMS\Serializer\Annotation\Expose; |
|
9
|
|
|
use JMS\Serializer\Annotation\Type; |
|
10
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @ExclusionPolicy("all") |
|
14
|
|
|
*/ |
|
15
|
|
|
class CustomerResponse |
|
16
|
|
|
{ |
|
17
|
|
|
const SOCIAL_NETWORK_FACEBOOK= 'facebook'; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var Customer |
|
21
|
|
|
* |
|
22
|
|
|
* @Type("AppBundle\Entity\Customer") |
|
23
|
|
|
* @Expose |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $customer; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
* |
|
30
|
|
|
* @Type("string") |
|
31
|
|
|
* @Accessor(getter="getApiKey") |
|
32
|
|
|
* @Expose |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $apiKey; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
* |
|
39
|
|
|
* @Type("string") |
|
40
|
|
|
* @Accessor(getter="getSocialNetwork") |
|
41
|
|
|
* @Assert\NotBlank(groups={"socialNetwork"}) |
|
42
|
|
|
* @Assert\Choice(callback="getSocialNetworks", groups={"socialNetwork"}) |
|
43
|
|
|
* @Expose |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $socialNetwork; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var string |
|
49
|
|
|
* |
|
50
|
|
|
* @Type("string") |
|
51
|
|
|
* @Accessor(getter="getSocialToken") |
|
52
|
|
|
* @Assert\NotBlank(groups={"socialNetwork"}) |
|
53
|
|
|
* @Expose |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $socialToken; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param Customer $customer |
|
59
|
|
|
*/ |
|
60
|
|
|
public function __construct($customer) |
|
61
|
|
|
{ |
|
62
|
|
|
$this->customer = $customer; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return Customer |
|
67
|
|
|
*/ |
|
68
|
|
|
public function getCustomer() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->customer; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param Customer $customer |
|
75
|
|
|
* @return $this |
|
76
|
|
|
*/ |
|
77
|
|
|
public function setCustomer($customer) |
|
78
|
|
|
{ |
|
79
|
|
|
$this->customer = $customer; |
|
80
|
|
|
|
|
81
|
|
|
return $this; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return string |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getApiKey() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->getCustomer()->getApiKey(); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getSocialNetwork() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->socialNetwork; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return array |
|
102
|
|
|
*/ |
|
103
|
|
|
public static function getSocialNetworks() |
|
104
|
|
|
{ |
|
105
|
|
|
return [ |
|
106
|
|
|
self::SOCIAL_NETWORK_FACEBOOK, |
|
107
|
|
|
]; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @return string |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getSocialToken() |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->socialToken; |
|
116
|
|
|
} |
|
117
|
|
|
} |
|
118
|
|
|
|