public function addChild(Category $child)
 {
     if (!$this->children[$child->getName()]) {
         $this->children[] = $child;
     } else {
         throw new FoursquareException('Child already exists.');
     }
     return $this;
 }
Example #2
0
 public function addCategory($category)
 {
     if ($category instanceof fsCategory) {
         $this->categories[] = $category;
         return $this;
     } elseif (is_array($category)) {
         $c = new fsCategory();
         $c->fromArray($category);
         return $this;
     } else {
         throw new FoursquareException('Category should be an array or a single entity of type Ddnet\\FoursquareBundle\\Entity\\Category');
     }
 }
Example #3
0
 /**
  * Add A Primary Category (will overwrite existing value)
  * 
  * @param \Ddnet\FoursquareBundle\Entity\Category $category
  * @param boolean $addIfNone
  * 
  * @return \Ddnet\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;
 }