public function addBeneficiary(BeneficiaryUser $beneficiary) { if (!$this->beneficiaries->contains($beneficiary)) { $this->beneficiaries->add($beneficiary); } return $this; }
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; }
/** * @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; }
/** * {@inheritdoc} */ public function hasActivity(ActivityInterface $activity) { return $this->activities->contains($activity); }
/** * {@inheritdoc} */ public function hasChild(PermissionInterface $permission) { return $this->children->contains($permission); }
/** * {@inheritdoc} */ public function contains($element) { $this->initialize(); return $this->coll->contains($element); }
/** * * @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(); } }
/** * Check that user has favorited bundles * * @param Bundle $bundle * * @return boolean */ public function hasFavoritedBundle(Bundle $bundle) { return $this->favoriteBundles->contains($bundle); }
/** * * @param Subject $child * @return boolean */ function hasChild($child) { return $this->children->contains($child); }
/** * {@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); }
/** * {@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); }
public function hasAttendance(Attendance $att) { return $this->attendances->contains($att); }
/** * 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); }