Пример #1
0
 /**
  * Removes an association of the given target entity with the activity entity
  * If the target entity has no association with the given activity entity it will be skipped
  *
  * @param ActivityInterface $activityEntity
  * @param object            $targetEntity
  *
  * @return bool TRUE if an association was removed; otherwise, FALSE
  */
 public function removeActivityTarget(ActivityInterface $activityEntity, $targetEntity)
 {
     if ($targetEntity !== null && $activityEntity->supportActivityTarget(get_class($targetEntity)) && $activityEntity->hasActivityTarget($targetEntity)) {
         $activityEntity->removeActivityTarget($targetEntity);
         if ($this->eventDispatcher) {
             $event = new ActivityEvent($activityEntity, $targetEntity);
             $this->eventDispatcher->dispatch(Events::REMOVE_ACTIVITY, $event);
         }
         return true;
     }
     return false;
 }
Пример #2
0
 /**
  * Removes an association of the given target entity with the activity entity
  * If the target entity has no association with the given activity entity it will be skipped
  *
  * @param ActivityInterface $activityEntity
  * @param object            $targetEntity
  *
  * @return bool TRUE if an association was removed; otherwise, FALSE
  */
 public function removeActivityTarget(ActivityInterface $activityEntity, $targetEntity)
 {
     if ($targetEntity !== null && $activityEntity->supportActivityTarget(get_class($targetEntity)) && $activityEntity->hasActivityTarget($targetEntity)) {
         $activityEntity->removeActivityTarget($targetEntity);
         return true;
     }
     return false;
 }