/**
  * Get items of a specific model
  * @param string|core_kernel_classes_Resource $itemModel - the item model URI
  * @return core_kernel_classes_Resource[] the found items
  */
 public function getAllByModel($itemModel)
 {
     if (!empty($itemModel)) {
         $uri = $itemModel instanceof core_kernel_classes_Resource ? $itemModel->getUri() : $itemModel;
         return $this->itemClass->searchInstances(array($this->itemModelProperty->getUri() => $uri), array('recursive' => true));
     }
     return array();
 }
 /**
  * Short description of method getNotificationsToSend
  *
  * @access public
  * @author Somsack Sipasseuth, <*****@*****.**>
  * @return array
  */
 public function getNotificationsToSend()
 {
     $returnValue = array();
     //get the notifications with the sent property to false
     $notifications = $this->notificationClass->searchInstances(array($this->notificationSentProp->getUri() => GENERIS_FALSE), array('like' => false, 'recursive' => 0));
     foreach ($notifications as $notification) {
         //there a date prop by sending try. After 4 try, we stop to try (5 because the 4 try and the 1st date is the creation date)
         $dates = $notification->getPropertyValues($this->notificationDateProp);
         if (count($dates) < 5) {
             $returnValue[] = $notification;
         }
     }
     return (array) $returnValue;
 }