Exemplo n.º 1
0
 /**
  * @param $id numeric
  *
  * @throws Exception
  */
 public function deleteId($id)
 {
     if (!is_numeric($id)) {
         throw new Exception('Wrong DELETE parameter: Non-numeric ID not allowed');
     }
     $this->database->delete($this->table)->where('id = ?', (int) $id)->execute();
 }
Exemplo n.º 2
0
 /**
  * @param object $instance
  * @param ClassMetadata $classMetadata
  * @return \DibiResult|int
  */
 private function deleteItem($instance, ClassMetadata $classMetadata)
 {
     $affectedRows = $this->dibiConnection->delete($classMetadata->getTable())->where($this->buildPrimaryKey($instance, $classMetadata))->execute(\dibi::AFFECTED_ROWS);
     $classKey = $this->getEntityClassHashKey($instance);
     unset($this->managedClasses[$classKey]);
     return $affectedRows;
 }
Exemplo n.º 3
0
 public function createModifyManyToMany(Association\ManyToMany $association, $primaryValue, array $refKeys, $action = self::ASSOC_ADD)
 {
     if ($action === self::ASSOC_ADD) {
         $fluent = $this->connection->insert($association->getJoinResource(), [$association->getJoinKey() => array_fill(0, count($refKeys), $primaryValue), $association->getReferencingKey() => $refKeys]);
     } else {
         $fluent = $this->connection->delete($association->getJoinResource())->where("%n = %s", $association->getJoinKey(), $primaryValue)->and("%n IN %l", $association->getReferencingKey(), $refKeys);
     }
     $query = new Query($fluent);
     $query->resultCallback = function (Query $query) {
         return $query->fluent->execute();
     };
     return $query;
 }
Exemplo n.º 4
0
 /**
  * Remove authorization code
  * @param string $authorizationCode
  * @return void
  */
 public function remove($authorizationCode)
 {
     $this->context->delete($this->getTable())->where('authorization_code = %s', $authorizationCode)->execute();
 }
Exemplo n.º 5
0
 protected function tearDown()
 {
     $this->db->delete("pages")->execute();
     $this->db->delete("connections")->execute();
     $this->db->delete("tags")->execute();
 }
Exemplo n.º 6
0
 public function delete($id)
 {
     return $this->connection->delete($this->table)->where('id=%i', $id)->execute();
 }
Exemplo n.º 7
0
 /**
  * @param int $id
  * @return bool
  */
 public function delete($id)
 {
     $this->database->delete(self::TABLE)->where(self::TABLE . '.id = %i', $id)->execute();
     return $this->database->getAffectedRows() == 1;
 }
Exemplo n.º 8
0
 /**
  * Remove refresh token
  * @param string $refreshToken
  */
 public function remove($refreshToken)
 {
     $this->context->delete($this->getTable())->where(array('refresh_token' => $refreshToken))->execute();
 }