/** * @param Term $term * * @return $this */ public function addTerm(Term $term) { if (false === $this->terms->contains($term)) { $this->terms->add($term); } return $this; }
/** * Collects terms where $prop matches $value * * @return ArrayCollection */ protected function getTermsBy($prop, $value) { $criteria = new Criteria(Criteria::expr()->eq($prop, $value)); return $this->terms->matching($criteria); }
/** * @param string $key * * @return $this */ public function removeTerm(Term $term) { $term->removeContentItem($this); $this->terms->removeElement($term); return $this; }