Mongolid\DataMapper\DataMapper::delete PHP Метод

delete() публичный Метод

Notice: Deletes with Unacknowledged WriteConcern will not fire deleted event.
public delete ( mixed $entity, array $options = [] ) : boolean
$entity mixed The entity used in the operation.
$options array Possible options to send to mongo driver.
Результат boolean Success (but always false if write concern is Unacknowledged)
    public function delete($entity, array $options = []) : bool
    {
        if ($this->fireEvent('deleting', $entity, true) === false) {
            return false;
        }
        $data = $this->parseToDocument($entity);
        $queryResult = $this->getCollection()->deleteOne(['_id' => $data['_id']], $this->mergeOptions($options));
        if ($queryResult->isAcknowledged() && $queryResult->getDeletedCount()) {
            $this->fireEvent('deleted', $entity);
            return true;
        }
        return false;
    }