1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Starkerxp\LeadBundle\Manager; |
4
|
|
|
|
5
|
|
|
use Starkerxp\LeadBundle\Entity\Lead; |
6
|
|
|
use Starkerxp\StructureBundle\Entity\Entity; |
7
|
|
|
use Starkerxp\StructureBundle\Manager\AbstractManager; |
8
|
|
|
use Starkerxp\StructureBundle\Manager\Exception\DeleteObjectNotAllowedException; |
9
|
|
|
use Starkerxp\StructureBundle\Manager\Exception\UpdateObjectNotAllowedException; |
10
|
|
|
|
11
|
|
|
class LeadManager extends AbstractManager |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
public function getSupport(Entity $object) |
15
|
|
|
{ |
16
|
|
|
return $object instanceof Lead; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @param Entity $object |
21
|
|
|
* @throws DeleteObjectNotAllowedException |
22
|
|
|
*/ |
23
|
|
|
public function delete(Entity $object) |
24
|
|
|
{ |
25
|
|
|
throw new DeleteObjectNotAllowedException(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param Entity $object |
30
|
|
|
* @return bool|Entity|void |
31
|
|
|
* @throws UpdateObjectNotAllowedException |
32
|
|
|
*/ |
33
|
|
|
public function update(Entity $object) |
34
|
|
|
{ |
35
|
|
|
throw new UpdateObjectNotAllowedException(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function toArray(Lead $object, $fields = []) |
39
|
|
|
{ |
40
|
|
|
$array = [ |
41
|
|
|
"id" => $object->getId(), |
42
|
|
|
"date_event" => $object->getDateEvent(), |
43
|
|
|
"origin" => $object->getOrigin(), |
44
|
|
|
"product" => $object->getProduct(), |
45
|
|
|
"external_reference" => $object->getExternalReference(), |
46
|
|
|
"pixel" => $object->getPixel(), |
47
|
|
|
"ip_address" => $object->getIpAddress(), |
48
|
|
|
"serialisation" => $object->getSerialisation(), |
49
|
|
|
]; |
50
|
|
|
|
51
|
|
|
return $this->exportFields($array, $fields); |
52
|
|
|
} |
53
|
|
|
} |
|
|
|
|
54
|
|
|
|
This check marks files that end in a newline character, i.e. an empy line.