delete() public method

Deletes the row corresponding to this active record.
public delete ( ) : boolean
return boolean whether the deletion is successful.
Esempio n. 1
0
 public function delete()
 {
     Context::get('db')->start_transaction();
     // delete blog comment
     BlogComment::neo()->where('blog_id = ?', $this->id)->delete();
     // delete blog
     parent::delete();
     Context::get('db')->commit();
 }
 public function removeAssociatedRecord(ActiveRecord $Record)
 {
     $associatedRecord =& $Record->getRecord();
     $associatedRecord[$this->_Association->getDefinition('foreignKey')] = null;
     if ($this->_Association->getDefinition('deleteWhenNotAssociated')) {
         $Record->delete(true);
     } else {
         $Record->setChanged();
     }
 }
 public function delete()
 {
     parent::delete();
     @unlink($this->getFilePath(true));
     @unlink($this->getFilePath(true) . '.' . $this->getSuffix());
     // We must update any definitions holding this signature
     $definitions = srCertificateDefinition::where(array('signature_id' => $this->getId()))->get();
     foreach ($definitions as $definition) {
         /** @var srCertificateDefinition $definition */
         $definition->setSignatureId(0);
         $definition->update();
     }
 }
Esempio n. 4
0
 public function delete_file($id)
 {
     $rs = false;
     $File = new ActiveRecord('uploads');
     if ($File->find($id)) {
         $subfolder = $File->fields['folder'] != '' ? $File->fields['folder'] . '/' : '';
         $path = $File->fields['ruta'] . $subfolder . $File->fields['archivo'];
         $File->delete();
         if (@unlink($path)) {
             $rs = true;
         }
     }
     return $rs;
 }
Esempio n. 5
0
 public function Eliminar()
 {
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('fk_perfiles');
     $C->fields['id_perfil'] = $this->id_perfil;
     $C->delete();
     $db->close();
 }
Esempio n. 6
0
 /**
  * Cascade deletion to children.
  */
 public function delete($delete_id = null)
 {
     parent::delete($delete_id);
     $this->constituent_schools()->delete($this->delete_id);
 }
Esempio n. 7
0
require_once 'activerecord.php';
$ar = new ActiveRecord();
$ar->connectPdo('blogdb', 'blog', $_POST['username'], $_POST['password']);
$postid = $ar->size() + 1;
$ar->pagenum = $postid;
$ar->author = $_POST['username'];
$ar->date = date('Y/m/d');
$ar->title = $_POST['title'];
$ar->text = nl2br($_POST['text']);
try {
    $ar->save();
} catch (Exception $e) {
    echo $e->getMessage();
    return;
}
$ar->connectPdo('blogdb', 'categorytable', $_POST['username'], $_POST['password']);
$categories = explode(',', $_POST["category"]);
foreach ($categories as $category) {
    $ar->postid = $postid;
    $ar->category = $category;
    try {
        $ar->save();
    } catch (Exception $e) {
        echo $e->getMessage();
        $ar->connectPdo('blogdb', 'blog', $_POST['username'], $_POST['password']);
        $postid = $ar->size();
        $ar->delete($postid);
        return;
    }
}
echo "{$postid}番目の記事を投稿しました";
 public function delete()
 {
     foreach ($this->getUdfCheckObjects() as $udf_check) {
         $udf_check->delete();
     }
     parent::delete();
 }
Esempio n. 9
0
 private function deleteLine()
 {
     $tableId = fk_post('tId');
     $id = fk_post($tableId . '_recId-' . fk_post('recIdToDel'));
     if ($id > 0) {
         $Ar = new ActiveRecord($this->table_name);
         $Ar->find($id);
         $Ar->delete();
     }
 }
Esempio n. 10
0
<?php

require_once 'activerecord.php';
$ar = new ActiveRecord();
$ar->connectPdo('blogdb', 'blog', $_POST['username'], $_POST['password']);
$ar->delete($_POST['postid']);
$ar->connectPdo('blogdb', 'categorytable', $_POST['username'], $_POST['password']);
$ar->delete($_POST['postid']);
 /**
  * Delete also related certificate definitions and assets
  */
 public function delete()
 {
     parent::delete();
     $definitions = srCertificateDefinition::where(array('type_id' => $this->getId()))->get();
     /** @var $def srCertificateDefinition */
     foreach ($definitions as $def) {
         $def->delete();
     }
 }
Esempio n. 12
0
 public static function delete($id)
 {
     DB::nonQuery('DELETE FROM `%s` WHERE CategoryID = %u', array(CategoryItem::$tableName, $id));
     return parent::delete($id);
 }
Esempio n. 13
0
 public function EliminarAdmin()
 {
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('usuarios');
     $C->fields['id_usuario'] = $this->id_usuario;
     $C->delete();
     $db->close();
 }
Esempio n. 14
0
 public function EliminarAlbaranes()
 {
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('albaranes');
     $C->fields['id_albaranes'] = $this->id_albaranes;
     $C->delete();
     $db->close();
 }
 /**
  * Also delete certificate file
  */
 public function delete()
 {
     parent::delete();
     @unlink($this->getFilePath());
 }
 public function delete()
 {
     // By deleting a placeholder, all placeholder values of existing definitions are deleted as well!
     foreach (srCertificatePlaceholderValue::where(array('placeholder_id' => $this->getId()))->get() as $value) {
         /** @var $value srCertificatePlaceholderValue */
         $value->delete();
     }
     parent::delete();
 }