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

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

Notice: Saves with Unacknowledged WriteConcern will not fire saved event.
public save ( 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 save($entity, array $options = [])
    {
        // If the "saving" event returns false we'll bail out of the save and return
        // false, indicating that the save failed. This gives an opportunities to
        // listeners to cancel save operations if validations fail or whatever.
        if ($this->fireEvent('saving', $entity, true) === false) {
            return false;
        }
        $data = $this->parseToDocument($entity);
        $queryResult = $this->getCollection()->replaceOne(['_id' => $data['_id']], $data, $this->mergeOptions($options, ['upsert' => true]));
        $result = $queryResult->isAcknowledged() && ($queryResult->getModifiedCount() || $queryResult->getUpsertedCount());
        if ($result) {
            $this->afterSuccess($entity);
            $this->fireEvent('saved', $entity);
        }
        return $result;
    }