You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the template MgiletNotificationBundle::notification_list.html.twig the notificationList is an array of objects with the seen property and a Notification instance.
Fetching whole NotifiableNotification entities would not cost any performance overhead (you are already joining on the table) and provides several advantages:
clarity, you know what you fetch
consistency, you would have the same list in notification_list.html.twig and notification.html.twig
routes (mark as seen, mark as unseen) would be easier to generate as you would have the NotifiableEntity->id at your disposal
you are fetching an entity, not a freeform object, this means that entity could then implements JsonSerializable interface; that would make notifications refreshing (or lazy load) much more practical
you could get ride of that ugly notificationItem[0] in your twig template and have something like item.notification and item.notifiable.id
The text was updated successfully, but these errors were encountered:
nreynis
changed the title
NotificationList passed to templates should be list of NotifiableNotification
NotificationList passed to templates should be a list of NotifiableNotification
Jan 12, 2018
nreynis
pushed a commit
to nreynis/notification-bundle
that referenced
this issue
Jan 12, 2018
In the template
MgiletNotificationBundle::notification_list.html.twig
thenotificationList
is an array of objects with theseen
property and a Notification instance.Fetching whole
NotifiableNotification
entities would not cost any performance overhead (you are already joining on the table) and provides several advantages:notification_list.html.twig
andnotification.html.twig
NotifiableEntity->id
at your disposalJsonSerializable
interface; that would make notifications refreshing (or lazy load) much more practicalnotificationItem[0]
in your twig template and have something likeitem.notification
anditem.notifiable.id
The text was updated successfully, but these errors were encountered: