示例#1
0
 /**
  * Remove record from this collection
  * @param array $options
  * @throws Exception
  * @return bool
  */
 public function delete(array $options = [])
 {
     if ($this->getIsNew()) {
         return false;
     }
     if ($this->beforeDelete() === false) {
         return false;
     }
     $options['multiple'] = false;
     if (!Buffer::add(Adapter::DELETE, $this, $options)) {
         if (!$this->forceDelete($options)) {
             return false;
         }
     }
     static::getCollection()->removeFromIdentityMap($this);
     $this->_id = null;
     $this->setIsNew(true);
     $this->afterDelete();
     return true;
 }