delete() public method

Delete a record from the database.
public delete ( mixed $id = null ) : integer
$id mixed
return integer
Example #1
0
 function delete($id)
 {
     $retId = $this->operator->delete($id);
     if ($retId) {
         //todo if here a bug ?
         $obj[$this->pkey] = $retId;
     }
     return $id;
 }
 /**
  * delete data
  *
  * @return int
  */
 public function delete()
 {
     if ($this->dynamic === false) {
         return $this->query->delete();
     }
     $result = $this->query->delete();
     if ($this->proxy === true) {
         $wheres = $this->query->wheres === null ? [] : $this->query->wheres;
         $this->getProxyManager()->delete($wheres);
     }
     return $result;
 }
Example #3
0
 /**
  * Force a delete on a set of soft deleted models.
  *
  * @return int
  */
 public function forceDelete()
 {
     return $this->query->delete();
 }
Example #4
0
 /**
  * Delete a record from the database.
  *
  * @param  null|int $id
  *
  * @return int
  */
 public function delete($id = null)
 {
     $result = parent::delete($id);
     $this->handler->setBuilder($this)->setValues([Reflector::PRIMARY_KEY_COLUMN => $id])->setSqlOperation('delete')->invalidateQuery('delete');
     return $result;
 }
Example #5
0
 public function delete($id = null)
 {
     if ($this->needFlushCache()) {
         // 清空表级缓存
         $meta = $this->getMeta();
         $meta->flush($this->db(), $this->model->table());
         $this->flushAffectingRowCache();
     }
     return parent::delete($id);
 }
Example #6
0
 /**
  * Delete a record from the database.
  *
  * @param  null|int $id
  *
  * @return int
  */
 public function delete($id = null)
 {
     $result = parent::delete($id);
     $this->handler->setBuilder($this)->invalidateQuery(Reflector::QUERY_TYPE_DELETE, [Reflector::PRIMARY_KEY_COLUMN => $id]);
     return $result;
 }
Example #7
0
 function delete($id = null)
 {
     return $this->_operator->delete($id);
 }