plugin/notification/Manager/NotificationManager.php
public function createNotification($actionKey, $iconKey, $resourceId = null, $details = [], $doer = null)
    {
        $notification = new Notification();
        $notification->setActionKey($actionKey);
        $notification->setIconKey($iconKey);
        $notification->setResourceId($resourceId);

        $doerId = null;

        if (null === $doer) {
            $doer = $this->getLoggedUser();
        }

        if (is_a($doer, 'Claroline\CoreBundle\Entity\User')) {
            $doerId = $doer->getId();
        }

        if (!isset($details['doer']) && !empty($doerId)) {
            $details['doer'] = [
                'id' => $doerId,
                'firstName' => $doer->getFirstName(),
                'lastName' => $doer->getLastName(),
                'avatar' => $doer->getPicture(),
                'publicUrl' => $doer->getPublicUrl(),
            ];
        }
        $notification->setDetails($details);
        $notification->setUserId($doerId);

        $this->getEntityManager()->persist($notification);
        $this->getEntityManager()->flush();

        return $notification;
    }
public function createNotification($actionKey, $iconKey, $resourceId = null, $details = [], $doer = null)
    {
        $notification = new Notification();
        $notification->setActionKey($actionKey);
        $notification->setIconKey($iconKey);
        $notification->setResourceId($resourceId);

        $doerId = null;

        if (null === $doer) {
            $doer = $this->getLoggedUser();
        }

        if (is_a($doer, 'Claroline\CoreBundle\Entity\User')) {
            $doerId = $doer->getId();
        }

        if (!isset($details['doer']) && !empty($doerId)) {
            $details['doer'] = [
                'id' => $doerId,
                'firstName' => $doer->getFirstName(),
                'lastName' => $doer->getLastName(),
                'avatar' => $doer->getPicture(),
                'publicUrl' => $doer->getPublicUrl(),
            ];
        }
        $notification->setDetails($details);
        $notification->setUserId($doerId);

        $this->getEntityManager()->persist($notification);
        $this->getEntityManager()->flush();

        return $notification;
    }
public function createNotification ( $ actionKey , $ iconKey , $ resourceId = null , $ details = [ ] , $ doer = null ) { $ notification = new Notification ( ) ; $ notification -> setActionKey ( $ actionKey ) ; $ notification -> setIconKey ( $ iconKey ) ; $ notification -> setResourceId ( $ resourceId ) ; $ doerId = null ; if ( null === $ doer ) { $ doer = $ this -> getLoggedUser ( ) ; } if ( is_a ( $ doer , 'Claroline\CoreBundle\Entity\User' ) ) { $ doerId = $ doer -> getId ( ) ; } if ( ! isset ( $ details [ 'doer' ] ) && ! empty ( $ doerId ) ) { $ details [ 'doer' ] = [ 'id' => $ doerId , 'firstName' => $ doer -> getFirstName ( ) , 'lastName' => $ doer -> getLastName ( ) , 'avatar' => $ doer -> getPicture ( ) , 'publicUrl' => $ doer -> getPublicUrl ( ) , ] ; } $ notification -> setDetails ( $ details ) ; $ notification -> setUserId ( $ doerId ) ; $ this -> getEntityManager ( ) -> persist ( $ notification ) ; $ this -> getEntityManager ( ) -> flush ( ) ; return $ notification ; }
Create new Tag given its name.

@param string      $actionKey
@param string      $iconKey
@param int|null    $resourceId
@param array       $details
@param object|null $doer

@internal param \Icap\NotificationBundle\Entity\NotifiableInterface $notifiable

@return Notification
Create new Tag given its name .