@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function __construct(array $data) |
20 | 20 | { |
21 | - parent::__construct( $data); |
|
21 | + parent::__construct($data); |
|
22 | 22 | $this->postId = $this->ulid('postId'); |
23 | 23 | $this->comments = [$this->array('comment')]; |
24 | 24 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function createTransaction($func): TransactionInterface |
21 | 21 | { |
22 | 22 | $em = $this->getEntityManager(); |
23 | - if(!$em->isOpen()) { |
|
23 | + if (!$em->isOpen()) { |
|
24 | 24 | $em = $this->managerRegistry->resetManager($this->getManagerName()); |
25 | 25 | } |
26 | 26 | return new DoctrineTransaction($em, $func); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @param $func |
24 | 24 | * @return TransactionInterface |
25 | 25 | */ |
26 | - public function createTransaction($func): TransactionInterface |
|
26 | + public function createTransaction($func): TransactionInterface |
|
27 | 27 | { |
28 | 28 | $em = $this->getEntityManager(); |
29 | 29 | if(!$em->isOpen()) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ) |
23 | 23 | { |
24 | 24 | $this->subscribedHandlers = Collection::from($this->subscribe()) |
25 | - ->map(function ($handlerMethodName, $eventClass) { |
|
25 | + ->map(function($handlerMethodName, $eventClass) { |
|
26 | 26 | return EventHandlerReference::create($handlerMethodName, $eventClass); |
27 | 27 | }) |
28 | 28 | ->realize(); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | { |
59 | 59 | return $this |
60 | 60 | ->subscribedHandlers |
61 | - ->filter(function ($ref) use ($event) { |
|
61 | + ->filter(function($ref) use ($event) { |
|
62 | 62 | return $ref->getEventName() == $event->getName(); |
63 | - })->map(function ($value) { |
|
63 | + })->map(function($value) { |
|
64 | 64 | return $value; |
65 | 65 | })->toArray(); |
66 | 66 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param CreateNewPostDto $newPost |
16 | 16 | * @return Ulid |
17 | 17 | */ |
18 | - public function createPost(CreateNewPostDto $newPost): Ulid |
|
18 | + public function createPost(CreateNewPostDto $newPost): Ulid |
|
19 | 19 | { |
20 | 20 | $id = new Ulid(); |
21 | 21 | $em = $this->getEntityManager(); |
@@ -24,14 +24,14 @@ |
||
24 | 24 | * @param Ulid $postId |
25 | 25 | * @param array $tags |
26 | 26 | */ |
27 | - public function createUpdateTags(Ulid $postId, array $tags): void |
|
27 | + public function createUpdateTags(Ulid $postId, array $tags): void |
|
28 | 28 | { |
29 | 29 | $this->tagsUpdatingRepository->updatePostTags($postId, $tags); |
30 | 30 | $this->deleteEmptyTags(); |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - public function deleteEmptyTags(): void |
|
34 | + public function deleteEmptyTags(): void |
|
35 | 35 | { |
36 | 36 | $this->tagsDeletingRepository->deleteEmptyTags(); |
37 | 37 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function onPostBaselined(PostBaselinedTagsIEvent $event): void |
36 | 36 | { |
37 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
38 | - if($this->postHeadersFindingRepository->postExists($event->getId())) { |
|
37 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
38 | + if ($this->postHeadersFindingRepository->postExists($event->getId())) { |
|
39 | 39 | $this->postEventsTagsRepository->updatePostHeader( |
40 | 40 | new UpdateExistingTagsPostHeaderDto( |
41 | 41 | $event->getId(), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function onPostCreated(PostCreatedTagsIEvent $event): void |
73 | 73 | { |
74 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
74 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
75 | 75 | $this->postEventsTagsRepository->createPostHeader( |
76 | 76 | new CreateNewTagsPostHeaderDto( |
77 | 77 | $event->getId(), |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function onPostUpdated(PostUpdatedTagsIEvent $event): void |
96 | 96 | { |
97 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
97 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
98 | 98 | $this->postEventsTagsRepository->updatePostHeader( |
99 | 99 | new UpdateExistingTagsPostHeaderDto( |
100 | 100 | $event->getId(), |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function onPostDeleted(PostDeletedTagsIEvent $event): void |
116 | 116 | { |
117 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
117 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
118 | 118 | $this->postEventsTagsRepository->deletePostHeader( |
119 | 119 | new DeleteExistingTagsPostHeaderDto($event->getId()) |
120 | 120 | ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function onPostBaselined(PostBaselinedCommentsIEvent $event): void |
37 | 37 | { |
38 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
38 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
39 | 39 | if ($this->postHeadersFindingRepository->postExists($event->getId())) { |
40 | 40 | $this->postEventsCommentsRepository->updatePostHeader( |
41 | 41 | new UpdateExistingCommentsPostHeaderDto( |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function onPostCreated(PostCreatedCommentsIEvent $event): void |
67 | 67 | { |
68 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
68 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
69 | 69 | $this->postEventsCommentsRepository->createPostHeader( |
70 | 70 | new CreateNewCommentsPostHeaderDto( |
71 | 71 | $event->getId(), |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function onPostUpdated(PostUpdatedCommentsIEvent $event): void |
84 | 84 | { |
85 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
85 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
86 | 86 | $this->postEventsCommentsRepository->updatePostHeader( |
87 | 87 | new UpdateExistingCommentsPostHeaderDto( |
88 | 88 | $event->getId(), |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function onPostDeleted(PostDeletedCommentsIEvent $event): void |
102 | 102 | { |
103 | - $this->transactionFactory->createTransaction(function () use ($event) { |
|
103 | + $this->transactionFactory->createTransaction(function() use ($event) { |
|
104 | 104 | $this->commentsDeletionRepository->deleteCommentsForPost($event->getId()); |
105 | 105 | $this->postEventsCommentsRepository->deletePostHeader( |
106 | 106 | new DeleteExistingCommentsPostHeaderDto($event->getId()) |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | p.id, p.title, p.body, p.summary, p.tags, p.createdById, p.createdByName, p.createdAt, p.updatedAt, p.version |
87 | 87 | ) from $postClass p where p.deletedAt is null"; |
88 | 88 | if ($from != null) { |
89 | - $dql = $dql . " and p.createdAt >= :from"; |
|
89 | + $dql = $dql." and p.createdAt >= :from"; |
|
90 | 90 | } |
91 | 91 | $query = $this->getEntityManager()->createQuery( |
92 | 92 | $dql |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $postClass = Post::class; |
107 | 107 | $dql = "select p.id as postId from $postClass p where p.deletedAt is not null"; |
108 | 108 | if ($from != null) { |
109 | - $dql = $dql . " and p.deletedAt >= :from"; |
|
109 | + $dql = $dql." and p.deletedAt >= :from"; |
|
110 | 110 | } |
111 | 111 | $query = $this->getEntityManager()->createQuery( |
112 | 112 | $dql |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return mixed |
28 | 28 | * @throws \Exception |
29 | 29 | */ |
30 | - public function execute(): mixed |
|
30 | + public function execute(): mixed |
|
31 | 31 | { |
32 | 32 | try { |
33 | 33 | $handler = $this->func; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param $func |
54 | 54 | * @return $this |
55 | 55 | */ |
56 | - public function afterCommit($func): TransactionInterface |
|
56 | + public function afterCommit($func): TransactionInterface |
|
57 | 57 | { |
58 | 58 | $this->afterCommit = $this->afterCommit->append($func); |
59 | 59 | return $this; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param $func |
64 | 64 | * @return $this |
65 | 65 | */ |
66 | - public function afterRollback($func): TransactionInterface |
|
66 | + public function afterRollback($func): TransactionInterface |
|
67 | 67 | { |
68 | 68 | $this->afterRollback = $this->afterRollback->append($func); |
69 | 69 | return $this; |
@@ -33,14 +33,14 @@ |
||
33 | 33 | $handler = $this->func; |
34 | 34 | $result = $handler(); |
35 | 35 | $this->afterCommit |
36 | - ->each(function ($successFn) use ($result) { |
|
36 | + ->each(function($successFn) use ($result) { |
|
37 | 37 | $successFn($result); |
38 | 38 | }) |
39 | 39 | ->realize(); |
40 | 40 | return $result; |
41 | 41 | } catch (\Exception $e) { |
42 | 42 | $this->afterRollback |
43 | - ->each(function ($rollbackFn) { |
|
43 | + ->each(function($rollbackFn) { |
|
44 | 44 | $rollbackFn(); |
45 | 45 | }) |
46 | 46 | ->realize(); |