for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Site notification class
*/
class SiteNotification extends ElggObject {
const HAS_ACTOR = "hasActor";
* {@inheritDoc}
protected function initializeAttributes() {
parent::initializeAttributes();
$this->attributes['subtype'] = 'site_notification';
}
* Get the actor involved in the notification
*
* @return ElggEntity|null
public function getActor() {
$actor = $this->getEntitiesFromRelationship(['relationship' => self::HAS_ACTOR]);
if ($actor) {
$actor = $actor[0];
return $actor;
return $actor
false
null|ElggEntity
* Set the actor involved in the notification
* @param ElggEntity $entity Actor
* @return void
public function setActor($entity) {
$this->addRelationship($entity->guid, self::HAS_ACTOR);
public function getURL() {
return (string) $this->url;
* Set the url for the notification
* @param string $url The URL for the notification link
public function setURL($url) {
if ($url) {
$this->url = $url;
url
* Set the read status
* @param bool $read Has the notification been read
public function setRead($read) {
$this->read = $read;
read
* Has the notification been read?
* @return bool
public function isRead() {
return (bool) $this->read;