Ejemplo n.º 1
0
 /**
  * @param int $offset
  * @param int $limit
  * @param string $order
  * @return TagCollection
  */
 public function findTags($offset = 0, $limit = PHP_INT_MAX, $order = 'id ASC')
 {
     $sql = new Sql($this->adapter);
     $select = $sql->select();
     $select->from('tag');
     $select->offset($offset);
     $select->limit($limit);
     $select->order($order);
     $statement = $sql->prepareStatementForSqlObject($select);
     $result = $statement->execute();
     $selectStatement = $this->adapter->createStatement('SELECT FOUND_ROWS() as total;');
     $total = $selectStatement->execute();
     $total = (int) $total->current();
     $collection = new TagCollection();
     $collection->setTotalCount($total);
     foreach ($result as $row) {
         $entity = $this->createEntity($row);
         $collection->addElement($entity, $entity->getId());
     }
     return $collection;
 }
Ejemplo n.º 2
0
 /**
  * Returns a prefilled CategoryCollection
  *
  * @return  \BFewo\Iterator\CategoryCollection
  */
 protected function prepareCategoryCollection()
 {
     $categoryCollection = new CategoryCollection();
     for ($c = 0; $c < 5; $c++) {
         $postCollection = new PostCollection();
         $category = new Category($postCollection);
         $categoryCollection->append($category);
         for ($p = 0; $p < 5; $p++) {
             $tagCollection = new TagCollection();
             $post = new Post($tagCollection);
             $postCollection->append($post);
             for ($t = 0; $t < 5; $t++) {
                 $tag = new Tag();
                 $tagCollection->append($tag);
             }
         }
     }
     return $categoryCollection;
 }
Ejemplo n.º 3
0
 public function prependInnerTag(Tag $tag)
 {
     $this->innerHtmlTags->prepend($tag);
     return $this;
 }
Ejemplo n.º 4
0
 public function getTags()
 {
     $id = $this->getPK();
     $crossReferenceTable = 'node_tag';
     $subQuery = new Ajde_Db_Function('(SELECT tag FROM ' . $crossReferenceTable . ' WHERE node = ' . $this->getPK() . ')');
     $collection = new TagCollection();
     $collection->addFilter(new Ajde_Filter_Where('id', Ajde_Filter::FILTER_IN, $subQuery));
     return $collection;
 }
Ejemplo n.º 5
0
 protected function parseTags()
 {
     $tagCollection = new TagCollection();
     $this->tags = $this->crawler->filter('.video-info-row:contains("Tags:") a:not(:contains("Suggest"))')->each(function (Crawler $node) use($tagCollection) {
         $tagCollection->add(new Tag($this->client, $node->link()->getUri()));
     });
     $this->tags = $tagCollection;
 }