@@ -17,6 +17,9 @@ discard block |
||
17 | 17 | $this->databaseConfiguration = $databaseConfiguration; |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param \DateTime $now |
|
22 | + */ |
|
20 | 23 | public function setReadAtDate(DatabaseNotificationInterface $notification, $now = null, $flush = true) |
21 | 24 | { |
22 | 25 | if (empty($now)) { |
@@ -31,6 +34,9 @@ discard block |
||
31 | 34 | } |
32 | 35 | } |
33 | 36 | |
37 | + /** |
|
38 | + * @param \DateTime $now |
|
39 | + */ |
|
34 | 40 | public function setUsersNotificationsAsRead(NotifiableInterface $notifiable, $now = null) |
35 | 41 | { |
36 | 42 | $entity = $this->notificationEntityName(); |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace IrishDan\NotificationBundle\Formatter; |
4 | 4 | |
5 | 5 | use IrishDan\NotificationBundle\Message\DatabaseMessage; |
6 | -use IrishDan\NotificationBundle\Notification\NotifiableInterface; |
|
7 | 6 | use IrishDan\NotificationBundle\Notification\NotificationInterface; |
8 | 7 | |
9 | 8 | class DatabaseDataFormatter extends BaseFormatter implements MessageFormatterInterface |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | // @TODO: Add existing bundle validation |
51 | 51 | $question->setValidator(['Sensio\Bundle\GeneratorBundle\Command\Validators', 'validateBundleName']); |
52 | - $question->setNormalizer(function ($value) { |
|
52 | + $question->setNormalizer(function($value) { |
|
53 | 53 | return $value ? trim($value) : ''; |
54 | 54 | }); |
55 | 55 | $question->setMaxAttempts(2); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | // @TODO: Add existing bundle validation |
52 | 52 | $question->setValidator(['Sensio\Bundle\GeneratorBundle\Command\Validators', 'validateBundleName']); |
53 | - $question->setNormalizer(function ($value) { |
|
53 | + $question->setNormalizer(function($value) { |
|
54 | 54 | return $value ? trim($value) : ''; |
55 | 55 | }); |
56 | 56 | $question->setMaxAttempts(2); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | // Get the new class name and validate it. |
68 | 68 | $question = new Question($questionHelper->getQuestion('The notification name', $input->getOption('notification_name')), $input->getOption('notification_name')); |
69 | - $question->setValidator(function ($answer) { |
|
69 | + $question->setValidator(function($answer) { |
|
70 | 70 | // Should only contain letters. |
71 | 71 | $valid = preg_match('/^[a-zA-Z]+$/', $answer); |
72 | 72 | if (!$valid) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | return $answer; |
79 | 79 | }); |
80 | - $question->setNormalizer(function ($value) { |
|
80 | + $question->setNormalizer(function($value) { |
|
81 | 81 | return $value ? trim($value) : ''; |
82 | 82 | }); |
83 | 83 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | protected function createYesNoQuestion($questionHelper, $input, $channel) |
133 | 133 | { |
134 | 134 | $question = new Question($questionHelper->getQuestion('Generate a message template for the ' . $channel . ' <comment>[yes]</comment>', 'channel_templates'), 'yes'); |
135 | - $question->setNormalizer(function ($value) { |
|
135 | + $question->setNormalizer(function($value) { |
|
136 | 136 | return $value[0] == 'y' ? 'y' : 'n'; |
137 | 137 | }); |
138 | 138 | |
139 | - $question->setValidator(function ($answer) { |
|
139 | + $question->setValidator(function($answer) { |
|
140 | 140 | // Should only contain letters. |
141 | 141 | $allowed = [ |
142 | 142 | 'y', |
@@ -35,7 +35,7 @@ |
||
35 | 35 | public function markAsRead() |
36 | 36 | { |
37 | 37 | // @TODO: sort it. |
38 | - $this->entities->forAll(function ($notification) { |
|
38 | + $this->entities->forAll(function($notification) { |
|
39 | 39 | $notification->markAsRead(); |
40 | 40 | }); |
41 | 41 | } |