Exemple #1
0
 /**
  * Metodo que inserta los datos.
  * @return bool Si es TRUE, todo se realizo correctamente.
  */
 public function insert()
 {
     $db = DBController::getConnection();
     $table = PostTerm::getTableName();
     $count = \count($this->termsID);
     $error = \FALSE;
     for ($i = 0; $i < $count && !$error; ++$i) {
         $termID = $this->termsID[$i];
         $this->prepareStatement = [];
         $this->prepare($termID);
         $error = !$db->insert($table, self::$COLUMNS, self::$VALUES, $this->prepareStatement);
     }
     return !$error;
 }
Exemple #2
0
 /**
  * Metodo que borra los datos.
  * @return bool Si es TRUE, todo se realizo correctamente.
  */
 public function delete()
 {
     $db = DBController::getConnection();
     $table = PostTerm::getTableName();
     $parameterTermID = PostTerm::RELATIONSHIPS_TERM_ID;
     $parameterPostID = PostTerm::RELATIONSHIPS_POST_ID;
     $where = "{$parameterTermID} = :{$parameterTermID} AND {$parameterPostID} = :{$parameterPostID}";
     $count = \count($this->termsID);
     $error = \FALSE;
     for ($i = 0; $i < $count && !$error; ++$i) {
         $termID = $this->termsID[$i];
         $this->prepareStatement = [];
         $this->prepare($termID);
         $error = !$db->delete($table, $where, $this->prepareStatement);
     }
     return !$error;
 }
Exemple #3
0
 /**
  * Metodo que agrega las relaciones post-etiqueta.
  * @param PostTerm $postTerm
  */
 public function addPostTerm(PostTerm $postTerm)
 {
     $this->postsID[$postTerm->getTermID()][] = $postTerm->getPostID();
     $this->termsID[$postTerm->getPostID()][] = $postTerm->getTermID();
 }