From 256dd1a9795f7b69a5b5ae3b44d03e0155a1d056 Mon Sep 17 00:00:00 2001 From: ssv Date: Fri, 22 Feb 2019 12:29:31 +0500 Subject: [PATCH 1/3] table name fix; --- README.md | 9 ++++++++- src/models/Notification.php | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1001a1b..e3d036d 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Once the component is configured it may be used for sending notifications: $recipient = User::findOne(1); $notification = new InvoicePaid($invoice); -Yii::$app->notifier->send($recipient, $nofitication); +Yii::$app->notifier->send($recipient, $notification); ``` Each notification class should implement NotificationInterface and contains a via method and a variable number of message building methods (such as `exportForMail`) that convert the notification to a message optimized for that particular channel. Example of notification that covers the case when an invoice has been paid: @@ -125,6 +125,13 @@ You may use the NotifiableInterface and NotifiableTrait on any of your models: { return $this->email; } + + // By default only 'mail' channel is used + public function viaChannels() + { + return ['mail', 'database', ]; + } + } ``` diff --git a/src/models/Notification.php b/src/models/Notification.php index ce0bec8..066f715 100644 --- a/src/models/Notification.php +++ b/src/models/Notification.php @@ -26,6 +26,11 @@ class Notification extends ActiveRecord { + public static function tableName() + { + return 'notification'; + } + /** * @inheritdoc */ From a77c50b6eb8b20b1f81d561695f221aa5236ef92 Mon Sep 17 00:00:00 2001 From: drtsb Date: Wed, 3 Apr 2019 19:14:44 +0500 Subject: [PATCH 2/3] fix composer.json dependencies --- .gitignore | 3 ++- composer.json | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ebe2b01..dac989f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ vendor composer.phar .DS_Store -composer.lock \ No newline at end of file +composer.lock +phpunit.xml \ No newline at end of file diff --git a/composer.json b/composer.json index e7d27ae..90bc32f 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,14 @@ "yiisoft/yii2-httpclient": "^2.0" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "^7.0" }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ], "autoload": { "psr-4": { "tuyakhov\\notifications\\": "src/", From c80a9eea6a8523f7a7a7c3e4038c47b2fd557cb8 Mon Sep 17 00:00:00 2001 From: drtsb Date: Wed, 3 Apr 2019 19:26:19 +0500 Subject: [PATCH 3/3] fix phpunit version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 90bc32f..b75cc12 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "yiisoft/yii2-httpclient": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^5.0" }, "repositories": [ {