Add accessor for bundled events in EventPresentationModel

The implementation of this sucks as the presentation model
should not be making database queries. But the API it provides
is what we want and will be supported even if the backend
implementation is changed.

Change-Id: Ifd0d11260990fd0e00e8f32eee273f9717d3e1fb
This commit is contained in:
Kunal Mehta 2015-11-19 10:06:58 -08:00
parent a00628b42a
commit 9057196d21

View file

@ -80,6 +80,26 @@ abstract class EchoEventPresentationModel {
return $msg;
}
/**
* @return EchoEvent[]
*/
final protected function getBundledEvents() {
if ( !$this->event->getBundleHash() ) {
return array();
}
// FIXME: We really shouldn't be making db queries like this
// in the presentation model
$eventMapper = new EchoEventMapper();
$events = $eventMapper->fetchByUserBundleHash(
$this->user,
$this->event->getBundleHash()
// default params: web, DESC, limit=250
);
return $events;
}
/**
* @return string The symbolic icon name as defined in $wgEchoNotificationIcons
*/