public function addBeneficiary(BeneficiaryUser $beneficiary)
 {
     if (!$this->beneficiaries->contains($beneficiary)) {
         $this->beneficiaries->add($beneficiary);
     }
     return $this;
 }
Example #2
0
 public function addRole(Role $role)
 {
     if (!$this->roles->contains($role)) {
         $this->roles->add($role);
     }
     return $this;
 }
 public function addOrganization(OrganizationUser $organization)
 {
     $organization->addBeneficiary($this);
     if (!$this->organizations->contains($organization)) {
         $this->organizations->add($organization);
     }
     return $this;
 }
Example #4
0
 /**
  * @param SubscriberInterface $subscriber
  * @return Newsletter
  */
 public function addSubscriber(SubscriberInterface $subscriber)
 {
     if ($this->subscribers->contains($subscriber)) {
         return $this;
     }
     $subscriber->addNewsletter($this);
     $this->subscribers->add($subscriber);
     return $this;
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function hasActivity(ActivityInterface $activity)
 {
     return $this->activities->contains($activity);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function hasChild(PermissionInterface $permission)
 {
     return $this->children->contains($permission);
 }
 /**
  * {@inheritdoc}
  */
 public function contains($element)
 {
     $this->initialize();
     return $this->coll->contains($element);
 }
Example #8
0
 /**
  * 
  * @param Exam $exam
  * @return boolean
  */
 function hasExam($exam)
 {
     return $this->exams->contains($exam);
 }
 /**
  * @see Collection_Mutable::retainAll() Collection_Mutable::retainAll()
  */
 public function retainAll(Collection $elements_)
 {
     $elements = [];
     foreach ($this->m_elements as $element) {
         if ($elements_->contains($element)) {
             array_push($elements, $element);
         }
     }
     $this->m_elements = $elements;
     $this->m_count = count($elements);
     if (false === isset($this->m_elements[$this->m_position])) {
         $this->previous();
     }
 }
Example #10
0
 /**
  * Check that user has favorited bundles
  *
  * @param Bundle $bundle
  *
  * @return boolean
  */
 public function hasFavoritedBundle(Bundle $bundle)
 {
     return $this->favoriteBundles->contains($bundle);
 }
Example #11
0
 /**
  * 
  * @param Subject $child
  * @return boolean
  */
 function hasChild($child)
 {
     return $this->children->contains($child);
 }
Example #12
0
 /**
  * {@inheritdoc}
  */
 public function contains($element)
 {
     /* DRAFT
        if ($this->_initialized) {
            return $this->_coll->contains($element);
        } else {
            if ($element is MANAGED) {
                if ($this->_coll->contains($element)) {
                    return true;
                }
                $exists = check db for existence;
                if ($exists) {
                    $this->_coll->add($element);
                }
                return $exists;
            }
            return false;
        }*/
     $this->_initialize();
     return $this->_coll->contains($element);
 }
Example #13
0
 /**
  * {@inheritdoc}
  */
 public function hasPromotion(PromotionInterface $promotion)
 {
     return $this->promotions->contains($promotion);
 }
 public function retainAll(Collection $c)
 {
     $toRemove = array();
     foreach ($this as $element) {
         if (!$c->contains($element)) {
             $toRemove[] = $element;
         }
     }
     $this->removeArray($toRemove);
 }
Example #15
0
 public function hasAttendance(Attendance $att)
 {
     return $this->attendances->contains($att);
 }
Example #16
0
 /**
  * Compare with current collection, add missing, remove unnecessary on current
  *
  * @param Collection $collection
  *
  * @return $this|self
  */
 public function diff(Collection $collection) : self
 {
     foreach ($this->elements as $element) {
         if (!$collection->contains($element)) {
             $this->removeElement($element);
         }
     }
     foreach ($collection as $element) {
         if (!$this->contains($element)) {
             $this->add($element);
         }
     }
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function hasActivityPrototype(ActivityPrototypeInterface $activityPrototype)
 {
     return $this->activityPrototypes->contains($activityPrototype);
 }