bakkerij / notifier

Notifications plugin for CakePHP 3.x
MIT License
59 stars 38 forks source link

allNotificationList() is not working #10

Closed iaditya closed 8 years ago

iaditya commented 8 years ago

Here is my code - dump($this->Notifier->allNotificationList($userid, true));

got Error :

Error: Call to undefined method Notifier\Controller\Component\NotifierComponent::allNotificationList() File /Users/adityagupta/talkadoc/vendor/cakedc/users/src/Controller/UsersController.php Line: 70

bobmulder commented 8 years ago

The docs are wrong, you should use getNotifications. Sorry for being not clear enough!

PS. You should use debug() instead of dump() ;)

iaditya commented 8 years ago

So how do we get to read/unread notifications?

bobmulder commented 8 years ago

See here: https://github.com/cakemanager/cakephp-notifier/blob/master/src/Controller/Component/NotifierComponent.php#L96

Second parameter is used for the state (true, or false)

iaditya commented 8 years ago

Ya . it's ok But , when we create a notification, it stores the state's value 1 not 0.

Thanks

bobmulder commented 8 years ago

That means it isn't read yet...

iaditya commented 8 years ago

It adds a new notification but the state value is 1. and for unread notification - $this->Notifier->countNotifications($userid, false); got value 0; and $this->Notifier->countNotifications($userid, true); // it's working got value - (number of notifications)

iaditya commented 8 years ago

Hey , Please tell me on thing , state value = 1 means true ?

And what is the logic behind changing the value of state in notifications, so we get to read/unread notifications? How does value changed?

bobmulder commented 8 years ago

https://github.com/cakemanager/cakephp-cakeadmin/blob/master/src/Controller/Admin/NotificationsController.php#L37

iaditya commented 8 years ago

Once again thank you.