Update an object in the persistence.

@param object $object The modified object
@return void
@throws UnknownObjectException
@api
961901
public function update($object)
    {
        if ($this->isNewObject($object)) {
            throw new UnknownObjectException('The object of type "' . get_class($object) . '" given to update must be persisted already, but is new.', 1249479819);
        }
        $this->hasUnpersistedChanges = true;
        $this->changedObjects->attach($object);
    }
110526
public function removeObject($object)
    {
        $oid = spl_object_hash($object);
        $data = [];
        if (isset($this->objectsRepository[$oid])) {
            $repository = $this->objectsRepository[$oid];
            $data = $repository->getHydrator()->unhydrate($object);
        }
        $id = isset($data['_id']) ? serialize($data['_id']) . $repository->getCollection() : $oid;

        if (!isset($this->objectStates[$id])) {
            throw new Exception\StateException("Can't remove object, it does not be managed");
        }

        unset($this->objectStates[$id]);
        unset($this->objects[$id]);
        unset($this->objectsRepository[$id]);
        unset($this->objectStates[$oid]);
        unset($this->objects[$oid]);
        unset($this->objectsRepository[$oid]);
    }
273782
public function remove($object)
    {
        $this->hasUnpersistedChanges = true;
        if ($this->addedObjects->contains($object)) {
            $this->addedObjects->detach($object);
        } else {
            $this->removedObjects->attach($object);
        }
    }
282130
public function add($object)
    {
        if ($this->removedNodes->contains($object)) {
            $this->removedNodes->detach($object);
        }
        if (!$this->addedNodes->contains($object)) {
            $this->addedNodes->attach($object);
        }
        parent::add($object);
    }
178641
public function cacheObject($object)
    {
        if (is_object($object)) {
            $unhyd = $this->hydrator->unhydrate($object);
            unset($unhyd["stream"]);
            $this->objectCache->save(spl_object_hash($object), $unhyd);
        }
    }
452929
public function remove($object)
    {
        foreach (array_keys($this->dataPlaceHolder) as $k) {
            if ($this->dataPlaceHolder[$k] === $object) {
                unset($this->dataPlaceHolder[$k]);

                return;
            }
        }
    }
716818
public function postUpdate($object): void
    {
        /** @var BlockAdmin $block */
        $blockManager = $this->blockManager;

        $block = $blockManager->get($object);
        $block->postUpdate($object);

        $service = $blockManager->get($object);

        $this->cacheManager->invalidate($service->getCacheKeys($object));
    }
166702
public function offsetSet($object, $data = null)
       {
            if (! parent::contains($object)) {
                parent::attach($object, $data);
                $this->map[$this->index++] = spl_object_hash($object);
                while(parent::valid()) {
                    parent::next();
                }
            }
       }
969904
public function add($object)
    {
        if (!is_object($object) || !($object instanceof $this->entityClassName)) {
            $type = (is_object($object) ? get_class($object) : gettype($object));
            throw new IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
        }
        $this->persistenceManager->add($object);
    }
101412
public function append($object)
    {
        $member = static::checkMember($object);
        # TODO: merge if duplicated
        if (!$this->contains($member)) {
            $this->members[] = $member;
        }
    }
1177519
public function persist($object, $collection = null)
    {
        $repository = $this->getRepository(get_class($object), $collection);
        $repository->getClassMetadata()->getEventManager()->execute(EventManager::EVENT_PRE_PERSIST, $object);
        $this->addObject($object, ObjectManager::OBJ_NEW, $repository);
        $repository->getClassMetadata()->getEventManager()->execute(EventManager::EVENT_POST_PERSIST, $object);

        return $this;
    }
958862
public function add($object)
    {
        $this->hasUnpersistedChanges = true;
        $this->addedObjects->attach($object);
        $this->removedObjects->detach($object);
    }
997626
private function _upsert($object, $id = null)
    {
        $object = $this->_writeObjectToDb($object, $id);
        $this->_updateObjectIndexes($object);
        $this->_commitObject($object->__id, $object->__revision);
        return $object;
    }
249857
private function _updateObjectIndexes($object)
    {
        //delete all indexed references to this object
        $update = Statement::get(
            'DELETE_OBJECT_INDEX',
            [
                '@collection' => $this->_name,
                '@id' => $this->_connector->quote($object->__id)
            ]
        );
        //parse each property of the object an attempt to index each value
        foreach (get_object_vars($object) as $property => $value) {
            if (
                $this->_isPropertyIndexable($property)
                && $this->_isValueIndexable($value)
            ) {
                $insert = Statement::get(
                    'INSERT_OBJECT_INDEX',
                    [
                        '@collection' => $this->_name,
                        '@type' => $this->_connector->quote('value'),
                        '@prop' => $this->_connector->quote($property),
                        '@val' => $this->_connector->quote($value),
                        '@id' => $this->_connector->quote($object->__id),
                        '@origin' => $this->_connector->quote($object->__origin)
                    ]
                );
                $update .= $insert;
            }
        }
        //add the object registry index
        $insert = Statement::get(
            'INSERT_OBJECT_INDEX',
            [
                '@collection' => $this->_name,
                '@type' => $this->_connector->quote('registry'),
                '@prop' => $this->_connector->quote(''),
                '@val' => $this->_connector->quote(''),
                '@id' => $this->_connector->quote($object->__id),
                '@origin' => $this->_connector->quote($object->__origin)
            ]
        );
        $update .= $insert;
        //execute all the sql to update indexes.
        $this->_connector->exec($update);
    }
653378
public function remove($object, $flush = true)
    {
        $this->isExpectedObject($object);
        $this->objectManager->remove($object);
        if ($flush) {
            $this->flush();
        }
    }
548588
public function update($object, $flushed = true)
    {
        $this->preUpdate($object, $flushed);
        $em = $this->getEntityManager();
        $em->persist($object);
        if ($flushed) {
            $em->flush($object);
        }
        $this->postUpdate($object, $flushed);
        return $object;
    }
619915
public function update($object)
    {
        if (!($object instanceof $this->objectType)) {
            throw new IllegalObjectTypeException('The modified object given to update() was not of the type (' . $this->objectType . ') this repository manages.', 1249479625);
        }
        $this->persistenceManager->update($object);
    }