/** * Add A Primary Category (will overwrite existing value) * * @param \Ner0tic\FoursquareBundle\Entity\Category $category * @param boolean $addIfNone * * @return \Ner0tic\FoursquareBundle\Entity\Venue */ public function addPrimaryCategory(Category $category, $addIfNone = true) { foreach ($this->categories as $cat) { if ($cat == $category) { $cat->setPrimary(true); $this->primaryCategory = $cat; } } if ($addIfNone) { $category->setPrimary(true); $this->addCategory($category); $this->primaryCategory = $category; } return $this; }
public function addChild(Category $child) { if (!$this->children[$child->getName()]) { $this->children[] = $child; } else { throw new FoursquareException('Child already exists.'); } return $this; }