@param object $object
@param array $data

@return array
485552
public static function unserialize($object, array $data)
    {
        $serializer = new static();
        $serializer->references = $data['@references'] ?? [];
        unset($data['@references']);

        return $serializer->unserializeObject($object, $data);
    }
750565
public function extract($object)
    {
        $data = [
            'group_class_id' => $object->getClass()->getId(),
            'name' => $object->getName(),
            'parent_id' => $object->hasParent() ? $object->getParent()->getId() : null,
        ];
        if ($object->getId()) {
            $data['id'] = $object->getId();
        }
        return $data;
    }
877810
public function hydrate(array $data, $object)
    {
        $object->setType($data['type'])
            ->setData($data['data'])
            ->setStore($data['store'])
            ->setDownload($data['download'])
            ->setOutputFilename($data['output_filename'])
            ->setCategory($data['category']);

        return $object;
    }
563336
public function fill($object, array $data)
    {
        if (! $object instanceof ConversionInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid object "%s" provided; must be an instance of "%s".',
                is_object($object) ? get_class($object) : gettype($object),
                ConversionInterface::CLASS
            ));
        }
        $object->fromArray($data);
    }
1285087
public static function serialize($object) : array
    {
        $serializer = new static();
        $data = $serializer->serializeObject($object);

        if (sizeof($serializer->referencesUsed)) {
            foreach ($serializer->referencesUsed as $index) {
                $data['@references'][$index] = $serializer->references[$index];
            }
        }

        return $data;
    }
188697
private function processSerializeTypeMethod(Type\Method $method, $object, array $data, string $attribute): array
    {
        $value = $object->{$method->getter()}();

        if ($this->checkNullForAttribute($value, $attribute) === false) {
            $data[$attribute] = $value;
        }

        return $data;
    }
685571
public function map($object, $data)
    {
        $object
            ->setProductId($data['OXID'])
            ->setRatingAverage($data['OXRATING'])
            ->setRatingCount($data['OXRATINGCNT']);

        return $object;
    }
1037621
public static function keys($object)
    {
        if ($object instanceof \stdClass)
            $object = (array)$object;

        if (is_array($object))
            return array_keys($object);

        $result = [];
        static::each($object, function ($item, $key) use (& $result) {
            $result[] = $key;
        });

        return $result;
    }
621759
public function hydrate(array $data, $object)
    {
        if (!isset($data['owner'])) {
            return $object;
        }

        $hydrators = new AggregateHydrator();
        $hydrators->add(new UserHydrator());
        $hydrators->add(new ImageCollectionAwareHydrator());

        $object->setOwner($hydrators->hydrate($data['owner'], new User()));

        return $object;
    }
1064595
protected static function rawData( $object )
    {
        if ( is_object( $object ) )
        {
            $hash = spl_object_hash( $object );

            if ( isset( self::$rawCheck[$hash] ) )
            {
                return array( '#recursion#' => $hash );
            }

            self::$rawCheck[$hash] = true;
        }

        $object = (array) $object;

        foreach ( $object as $key => $value )
        {
            if ( is_array( $value ) || is_object( $value ) )
            {
                $object[$key] = self::rawData( $value );
            }
        }

        return (object) $object;
    }
319553
public function update($object, array $data)
	{
		$updated = $object->update($data);

		if( ! $updated)
		{
			return new Payload($object , 'not_updated');
		}

		// Replace the existing cached model with the updated model.
		Cache::tags($this->model->getTable())->forever($updated->getKey(), $updated);

		return new Payload($object, 'updated');
	}
63117
public function toArray($object)
    {
        $result = array();
        $className = $this->getFullClassName($object);
        $metadata = $this->metadataFactory->getMetadataForClass($className);
        foreach ($metadata->getProperties() as $property) {
            if (!$property->isExpose() || $this->propertySkipper->shouldSkip($property)) {
                continue;
            }

            $value = $this->exposeValue($object, $property);
            $value = $this->handleValue($value, $property, self::DIRECTION_SERIALIZE);

            if ($property->isNullSkipped() && $value === null) {
                continue;
            }

            $result[$property->getSerializedName()] = $value;
        }

        return $result;
    }
99457
public function hydrate(array $data, $object)
    {
        $object->setId($data['id']);
        $object->setLogin($data['login']);
        $object->setName($data['name']);
        $object->setEmail($data['email']);
        $object->setRole($data['role']);
        return $object;
    }
874794
public function cursorForObjectInConnection(array $data, $object): ? string
    {
        $offset = null;

        foreach ($data as $i => $entry) {
            // When using the comparison operator (==), object variables are compared in a simple manner,
            // namely: Two object instances are equal if they have the same attributes and values,
            // and are instances of the same class.
            if ($entry == $object) {
                $offset = $i;
                break;
            }
        }

        if (null === $offset) {
            return null;
        }

        return $this->offsetToCursor($offset);
    }
958256
public function hydrate(array $data, $object)
    {
        if (!$object instanceof Request) {
            throw new \Exception('$object must be an instance of Request');
        }

        return parent::hydrate($data, $object);
    }
594332
private function unserializeObject($object, &$data, string $className = null) : array
    {
        $reflectionClass = new \ReflectionClass($className ? $className : $object);
        unset($data['@type']);

        // parent class
        $parent = $reflectionClass->getParentClass();
        if ($parent) {
            $this->unserializeObject($object, $data, $parent->getName());
        }

        foreach ($reflectionClass->getProperties() as $property) {
            $name = $property->getName();

            if (array_key_exists($name, $data)) {
                $currentValue = $data[$name];

                if (isset($data[$name]['@ref'])) {
                    $currentValue = $this->references[$data[$name]['@ref']];
                } elseif (isset($data[$name]['@type'])) {
                    $reflection = new \ReflectionClass($data[$name]['@type']);

                    $parent = $reflection;
                    $internal = false;

                    while ($parent !== false) {
                        $internal = $parent->isInternal() ? true : $internal;
                        $parent = $parent->getParentClass();
                    }

                    if ($internal) {
                        $currentData = $data[$name];
                        $currentType = $data[$name]['@type'];
                        unset($currentData['@type']);

                        $serialize = preg_replace(
                            '`^a:`',
                            'O:' . strlen($currentType) . ':"' . $currentType . '":',
                            serialize($currentData)
                        );
                        $currentValue = unserialize($serialize);
                    } else {
                        $currentValue = $reflection->newInstanceWithoutConstructor();
                        $this->unserializeObject($currentValue, $data[$name]);
                    }
                } elseif (is_array($currentValue)) {
                    $currentValue = [];
                    foreach ($data[$name] as $key => $value) {
                        if (isset($value['@type'])) {
                            $reflection = new \ReflectionClass($value['@type']);
                            $currentValue[$key] = $reflection->newInstanceWithoutConstructor();
                            $this->unserializeObject($currentValue[$key], $value);
                        } else {
                            $currentValue[$key] = $value;
                        }
                    }
                }

                $property->setAccessible(true);
                $property->setValue($object, $currentValue);

                unset($data[$name]);
            }
        }

        return $data;
    }
868111
private function update($object, array $data)
    {
        //only save when a change is detected
        if (!empty($data)) {
            $queryBuilder = $this->manager->getDriver()->getQueryBuilder();
            $primaryKey   = $this->getPrimaryKey();

            $this->manager->postPendingQuery(
                new PendingQuery(
                    $this,
                    PendingQuery::TYPE_UPDATE,
                    $queryBuilder
                        ->update($this->getTable())
                        ->values($queryBuilder->createPositionalParameter($data))
                        ->where(
                            $queryBuilder->expression()->eq(
                                $primaryKey,
                                $queryBuilder->createPositionalParameter(
                                    $this->getState($object)->getOriginalFieldData($primaryKey)
                                )
                            )
                        )
                )
            );
        }

        return $this->getPrimaryKeyValue($object);
    }