Refresh an object to last MongoDB values

@param   mixed       $object     Object to refresh
177708
public function refresh(&$object)
    {
        if (!isset($this->objectsRepository[spl_object_hash($object)])) {
            return;
        }
        $repository = $this->objectsRepository[spl_object_hash($object)];
        $id = $repository->getHydrator()->unhydrate($object)["_id"];
        $projection = $repository->getLastProjection($object);
        $collection = $repository->getCollection();
        $hydrator = $repository->getHydrator();

        if (null !== ($data = $collection->findOne(['_id' => $id], ['projection' => $projection]))) {
            $hydrator->hydrate($object, $data);
            $repository->cacheObject($object);
        } else {
            $object = null;
        }
        return $object;
    }
1084014
public static function reset($object)
	{
		if (!($object instanceof MethodOptions)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\MethodOptions.');
		}
		$object->deprecated = NULL;
		$object->uninterpretedOption = NULL;
	}
783493
public function save($object)
    {
        $ret = $this->getValidator()->validateSave($object);
        if ($ret) {
            $ret = $this->_save($object);
        }
        return $ret;
    }
1141750
static public function toCollections($object) {
        if ($object === null) {
            return null;
        }

        if (!is_array($object)) {
            if (is_object($object)) {
                foreach ($object as $key => $value) {
                    $object->$key = self::toCollections($value);
                }
            }
            return $object;
        }

        if (empty($object)) {
            return new Map();
        }

        $elements = array();
        $isList = true;
        $lastKey = -1;

        foreach ($object as $key => $element) {
            $elements[$key] = self::toCollections($element);

            if (!is_int($key) || intval($key) != $lastKey + 1) {
                $isList = false;
            }
            $lastKey = intval($key);
        }

        if ($isList) {
            return new Liste($elements);
        } else {
            return new Map($elements);
        }
    }
558515
public static function reset($object)
	{
		if (!($object instanceof UninterpretedOption)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\UninterpretedOption.');
		}
		$object->name = NULL;
		$object->identifierValue = NULL;
		$object->positiveIntValue = NULL;
		$object->negativeIntValue = NULL;
		$object->doubleValue = NULL;
		$object->stringValue = NULL;
		$object->aggregateValue = NULL;
	}
422868
private function getObjectPropertiesValues($object)
    {
        $properties = Core::get()->getGettablePropertiesOfObject($object);
        $finalProperties = [];

        foreach ($properties as $property) {
            $finalProperties[$property] = Core::get()->getObjectService()->getObjectProperty($object, $property);
        }

        return $finalProperties;
    }
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();
                }
            }
       }
586891
public static function reset($object)
	{
		if (!($object instanceof EnumDescriptorProto)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\EnumDescriptorProto.');
		}
		$object->name = NULL;
		$object->value = NULL;
		$object->options = NULL;
	}
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);
    }
923924
protected function optimizeObjectContent($object)
	{
		$object = $this->recordObject($object);
		$this->deduplicateConfigValues();

		return $object->getValue();
	}
997626
private function _upsert($object, $id = null)
    {
        $object = $this->_writeObjectToDb($object, $id);
        $this->_updateObjectIndexes($object);
        $this->_commitObject($object->__id, $object->__revision);
        return $object;
    }
637302
public function update($object, $flush = true)
    {
        try {
            $entityManager = $this->getEntityManager($object);
            $this->preUpdate($object);
            $entityManager->persist($object);
            if ($flush) {
                $entityManager->flush();
            }
            $this->postUpdate($object);
        } catch (\PDOException $e) {
            throw new ModelManagerException('', 0, $e);
        }
    }
598644
public function refresh($document)
    {
        $query = $this->getQueryForDocument($document);
        $data = $this->collection->findOne($query);
        $data = $this->hydratorFactory->hydrate($document, $data);
        $this->uow->setOriginalDocumentData($document, $data);
    }
111122
private static function doDump(&$data, $object)
    {
        if (is_object($object) && static::$objectStorage->contains($object)) {
            $data = null;

            return;
        }

        if (is_object($object)) {
            static::$objectStorage->attach($object);
        }

        if (is_array($object) || $object instanceof \Traversable) {
            foreach ($object as $key => $value) {
                static::doDump($data[$key], $value);
            }
        } elseif (is_object($object)) {
            $ref = new \ReflectionObject($object);

            $properties = $ref->getProperties();

            foreach ($properties as $property) {
                $property->setAccessible(true);

                $value = $property->getValue($object);

                static::doDump($data[$property->getName()], $value);
            }
        } else {
            $data = $object;
        }
    }
881682
public function push($object): self
    {
        $this->internalDataListUpdate();
        array_push($this->internalDataListData, $object);
        return $this;
    }
519602
public function refresh(object $document) : void
    {
        assert($this->collection instanceof Collection);
        $query = $this->getQueryForDocument($document);
        $data  = $this->collection->findOne($query);
        if ($data === null) {
            throw MongoDBException::cannotRefreshDocument();
        }
        $data = $this->hydratorFactory->hydrate($document, (array) $data);
        $this->uow->setOriginalDocumentData($document, $data);
    }
1136908
private function isExpired(Riak\Object $object)
	{
		$metadataMap = $object->getMetadataMap();

		return isset($metadataMap[self::EXPIRES_HEADER])
			&& $metadataMap[self::EXPIRES_HEADER] < \time();
	}