1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Speicher210\FastbillBundle\Controller\Notification; |
4
|
|
|
|
5
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Customer\CustomerChangedNotification; |
6
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Customer\CustomerCreatedNotification; |
7
|
|
|
use Speicher210\Fastbill\Api\Model\Notification\Customer\CustomerDeletedNotification; |
8
|
|
|
use Speicher210\FastbillBundle\Event\CustomerChangedEvent; |
9
|
|
|
use Speicher210\FastbillBundle\Event\CustomerCreatedEvent; |
10
|
|
|
use Speicher210\FastbillBundle\Event\CustomerDeletedEvent; |
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
12
|
|
|
use Symfony\Component\HttpFoundation\Response; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Controller for customers notifications. |
16
|
|
|
*/ |
17
|
|
|
class CustomerController extends AbstractController |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Action when a customer is created. |
21
|
|
|
* |
22
|
|
|
* @param Request $request The made request. |
23
|
|
|
* @return Response |
24
|
|
|
*/ |
25
|
3 |
|
public function createdAction(Request $request) |
26
|
|
|
{ |
27
|
3 |
|
$event = new CustomerCreatedEvent(); |
28
|
|
|
|
29
|
3 |
|
return $this->handleNotification($request, $event, CustomerCreatedNotification::class); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Action when a customer is changed. |
34
|
|
|
* |
35
|
|
|
* @param Request $request The made request. |
36
|
|
|
* @return Response |
37
|
|
|
*/ |
38
|
3 |
|
public function changedAction(Request $request) |
39
|
|
|
{ |
40
|
3 |
|
$event = new CustomerChangedEvent(); |
41
|
|
|
|
42
|
3 |
|
return $this->handleNotification($request, $event, CustomerChangedNotification::class); |
43
|
3 |
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Action when a customer is changed. |
47
|
|
|
* |
48
|
|
|
* @param Request $request The made request. |
49
|
|
|
* @return Response |
50
|
|
|
*/ |
51
|
3 |
|
public function deletedAction(Request $request) |
52
|
|
|
{ |
53
|
3 |
|
$event = new CustomerDeletedEvent(); |
54
|
|
|
|
55
|
3 |
|
return $this->handleNotification($request, $event, CustomerDeletedNotification::class); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|