Ejemplo n.º 1
0
 public function create(array $attributes)
 {
     $name = $attributes[0];
     $id = isset($attributes[1]) ? $attributes[1] : Null;
     $tag = new Tag($this, $name, $id);
     foreach ($this->listeners as $listener) {
         $tag->addListener($listener);
     }
     return $tag;
 }
Ejemplo n.º 2
0
 public function removeChild(Tag $tag)
 {
     $found = null;
     foreach ($this->getChildren() as $id => $child) {
         if ((int) $child->id === (int) $tag->id) {
             $found = $id;
             break;
         }
     }
     if ($found === null) {
         throw new Exception('Tag ' . $tag->name . '
 			is not child of ' . $this->name);
     }
     unset($this->children[$found]);
     $this->removedChildren[] = $tag;
     $tag->setParent(Null);
     // 		$this->collection->unIndexParent($tag, $this);
     $this->changed = True;
     return $this;
 }
Ejemplo n.º 3
0
 public function findByTag(Tag $tag)
 {
     return $this->getSelect('resource', $this->relationsTable, 'tag = ' . $tag->getId(), 'resource');
 }