/** * @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(); }
/** * @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; }
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; }
/** * Remove authorization code * @param string $authorizationCode * @return void */ public function remove($authorizationCode) { $this->context->delete($this->getTable())->where('authorization_code = %s', $authorizationCode)->execute(); }
protected function tearDown() { $this->db->delete("pages")->execute(); $this->db->delete("connections")->execute(); $this->db->delete("tags")->execute(); }
public function delete($id) { return $this->connection->delete($this->table)->where('id=%i', $id)->execute(); }
/** * @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; }
/** * Remove refresh token * @param string $refreshToken */ public function remove($refreshToken) { $this->context->delete($this->getTable())->where(array('refresh_token' => $refreshToken))->execute(); }