Beispiel #1
0
 public function erase($key = null)
 {
     if (null === $key) {
         $delete = parent::delete('thinsession', $this->_session->getId());
         return new self($this->_sessionName);
     } else {
         $data = $this->_session->getData();
         $data->{$key} = null;
         return $this->save();
     }
 }
Beispiel #2
0
 /**
  * Delete an item from the cache.
  *
  * @param  string  $key
  * @return void
  */
 public function forget($key)
 {
     $this->_cleanCache();
     $res = Data::query('cache', 'key = ' . $key . ' && namespace = ' . $this->namespace);
     if (count($res)) {
         $obj = Data::getObject(current($res));
         $del = Data::delete('cache', $obj->getId());
     }
 }
Beispiel #3
0
<?php

// check if value was posted
// include database and object file
include_once 'includes/config.php';
include_once 'includes/data.inc.php';
// get database connection
$database = new Config();
$db = $database->getConnection();
// prepare product object
$product = new Data($db);
// set product id to be deleted
$product->id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: missing ID.');
// delete the product
if ($product->delete()) {
    echo "<script>location.href='index.php'</script>";
} else {
    echo "<script>alert('Gagal menghapus data')</script>";
}
Beispiel #4
0
 /**
  * Get a DELETE variable in the request.
  *
  * @param string $k The key.
  *
  * @return string
  */
 public function delete($k = null)
 {
     return \Data::delete($k);
 }
Beispiel #5
0
 private function deleteTied($exemplars)
 {
     if (is_object($exemplars)) {
         $exemplars = [$exemplars];
     }
     $result = true;
     foreach ($exemplars as $exemplar) {
         foreach ($this->ties as $tie) {
             if (!isset($exemplar->{$tie->key})) {
                 throw new \Exception("Key doesn't exists in exemplar");
             }
             $tie->ids = $exemplar->{$tie->key};
             $criterion = ['where' => ['query' => "`{$this->table}_{$this->primary_field}`=?", 'vars' => $tie->ids]];
             $TieData = new Data($this->Db, $tie->name);
             $result = $TieData->delete($criterion, $tie->deletion_type);
         }
     }
     return $result;
 }