Esempio n. 1
0
 function delete()
 {
     $result = parent::delete();
     if ($result != FALSE) {
         $this->removeFromSolr();
     }
     return $result;
 }
Esempio n. 2
0
 public function delete($useWhere = false)
 {
     // avoid those annoying PEAR::DB strict standards warnings it causes
     $old = error_reporting();
     error_reporting(error_reporting() & ~E_STRICT);
     $res = parent::delete($useWhere);
     // reset
     error_reporting($old);
     return $res;
 }
Esempio n. 3
0
 function delete()
 {
     $personId = $this->personId;
     $ret = parent::delete();
     //Load the person this is for, and update solr
     if ($personId) {
         require_once ROOT_DIR . '/sys/Genealogy/Person.php';
         $person = Person::staticGet('personId', $personId);
         $person->saveToSolr();
     }
     return $ret;
 }
Esempio n. 4
0
 public function delete()
 {
     //Delete any items that are associated with the record
     if (strcasecmp($this->source, 'OverDrive') != 0) {
         $items = $this->getItems();
         foreach ($items as $item) {
             $item->delete();
         }
     }
     parent::delete();
 }
Esempio n. 5
0
 /**
  * Deletes items from table which match current objects variables.
  *
  * Returns the true on success
  *
  * for example
  *
  * Designed to be extended
  *
  * $object = new mytable();
  * $object->ID=123;
  * echo $object->delete(); // builds a conditon
  *
  * $object = new mytable();
  * $object->whereAdd('age > 12');
  * $object->limit(1);
  * $object->orderBy('age DESC');
  * $object->delete(true); // dont use object vars, use the conditions, limit and order.
  *
  * @param bool $useWhere (optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then
  *             we will build the condition only using the whereAdd's.  Default is to
  *             build the condition only using the object parameters.
  *
  *     * @return mixed Int (No. of rows affected) on success, false on failure, 0 on no data affected
  */
 public function delete($useWhere = FALSE)
 {
     $result = parent::delete($useWhere);
     $event = new \Civi\Core\DAO\Event\PostDelete($this, $result);
     \Civi::service('dispatcher')->dispatch("DAO::post-delete", $event);
     return $result;
 }
 /**
  * Overwrite DB_DataObject::delete() method and add a "ON DELETE CASCADE"
  *
  * @param boolean $useWhere
  * @param boolean $cascadeDelete  If true it deletes also referenced tables
  *                                if this behavior is set in DataObject.
  *                                With this parameter it's possible to turn off default behavior
  *                                @see DB_DataObjectCommon:onDeleteCascade
  * @param boolean $parentid The audit ID of the parent object causing the cascade.
  * @return mixed True on success, false on failure, 0 on no data affected
  * @access protected
  */
 function delete($useWhere = false, $cascadeDelete = true, $parentid = null)
 {
     $this->_addPrefixToTableName();
     // clone this object and retrieve current values for auditing
     $doAffected = clone $this;
     if (!$useWhere) {
         // Clear any additional WHEREs if it's not used in delete statement
         $doAffected->whereAdd();
     }
     $doAffected->find();
     if ($this->onDeleteCascade && $cascadeDelete) {
         $aKeys = $this->keys();
         // Simulate "ON DELETE CASCADE"
         if (count($aKeys) == 1) {
             // Resolve references automatically only for records with one column as Primary Key
             // If table has more than one column in PK it is still possible to remove
             // manually connected tables (by overriding delete() method)
             $primaryKey = $aKeys[0];
             $linkedRefs = $this->_collectRefs($primaryKey);
             foreach ($this->onDeleteCascadeSkip as $table) {
                 unset($linkedRefs[$table]);
             }
             // Find all affected tuples
             while ($doAffected->fetch()) {
                 $id = $doAffected->audit(3, null, $parentid);
                 // Simulate "ON DELETE CASCADE"
                 $doAffected->deleteCascade($linkedRefs, $primaryKey, $id);
             }
         }
     }
     $result = parent::delete($useWhere);
     if ($result) {
         if (is_null($id)) {
             $doAffected->fetch();
             $doAffected->audit(3, null, $parentid);
         }
         return true;
     }
     return $result;
 }
Esempio n. 7
0
 function delete()
 {
     $this->decache();
     # while we still have the values!
     return parent::delete();
 }
Esempio n. 8
0
 public function delete()
 {
     $result = $this->trigger('delete');
     switch (true) {
         case $result === 'bypass':
             $this->clearFromRegistry($this->tableName(), $this->pk());
             return true;
             break;
         case $result === 'fail':
             return false;
             break;
         default:
             if (parent::delete() !== false) {
                 $this->clearFromRegistry($this->tableName(), $this->pk());
                 $this->trigger('postdelete');
                 return true;
             }
             return false;
     }
 }
Esempio n. 9
0
 function delete()
 {
     $ret = parent::delete();
     return $ret;
 }