Ejemplo n.º 1
0
 /**
  * Load instances of Article entities that is tagged with the ArticleTag indicated by the tag param
  *
  * @access public
  * @param ArticleTag $tag
  * @param array $options (Optional) Read documentation on parseOptions for details
  * @return array
  */
 public function allWithTag(ArticleTag $tag, $options = null)
 {
     $tagDAO = ArticleTagDAO::getInstance();
     $taggedDAO = TaggedArticleDAO::getInstance();
     $this->resetQueryStrings();
     $this->query_reset_lock = true;
     $this->query_joins = " INNER JOIN {$taggedDAO->getTableName()} ON {$this->tableName}.id = {$taggedDAO->getTableName()}.articleId INNER JOIN {$tagDAO->getTableName()} ON {$taggedDAO->getTableName()}.tagId = {$tagDAO->getTableName()}.id ";
     $this->query_where = "WHERE {$tagDAO->getTableName()}.id = ?";
     $this->query_params = array($tag->getId());
     $result_array = $this->all($options);
     $this->query_reset_lock = false;
     return $result_array;
 }
 /**
  * Retrieve instance of an TaggedArticleDAO or create one if it does
  * not exist.
  *
  * @access public
  * @static
  * @return TaggedArticleDAO
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }