Convert an object and add it to the body/content of the request.

@param \eZ\Publish\API\Repository\Values\ValueObject $object Object to be converted
@param string $type Type for the body of the request (XML, JSON)
320108
protected function addObjectToRequestBody(ValueObject $object, $type)
    {
        $request = $this->convertObjectTo($object, $type);

        $this->restDriver->setBody($request->getContent());
    }
1259449
public function index($type, $object)
    {
        foreach ($this->getIndexes($type) as $index) {
            $index->index($object);
        }
    }
360397
private function processDeserializeTypeCollectionObject(Type\Collection\Object $objectType, $object, array $values)
    {
        $objects = [];
        foreach ($values as $key => $objectFromValue) {
            $objects[$key] = $this->setObjectForClass($objectType->className(), $objectFromValue);
        }

        $object->{$objectType->setter()}($objects);

        return $this;
    }
1071953
final public function populateForm(ITypedObject $object)
    {
        $this->verifyObject($object);
        $this->typedObject = $object;
        $this->populateFormWithobject($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);
    }
1077408
public static function fromObject($object)
    {
        try {
            if (!\is_object($object)) {
                throw new UnexpectedTypeException($object, 'object');
            }

            if ($object instanceof SubjectIdentityInterface) {
                return $object;
            }
            if ($object instanceof SubjectInterface) {
                return new self(ClassUtils::getClass($object), (string) $object->getSubjectIdentifier(), $object);
            }
            if (method_exists($object, 'getId')) {
                return new self(ClassUtils::getClass($object), (string) $object->getId(), $object);
            }
        } catch (InvalidArgumentException $e) {
            throw new InvalidSubjectIdentityException($e->getMessage(), 0, $e);
        }

        throw new InvalidSubjectIdentityException('The object must either implement the SubjectInterface, or have a method named "getId"');
    }
117763
public function set(ITypedObject $object, array &$properties, $value)
    {
        call_user_func($this->setterCallback, $object, $value);
    }
877288
public function cast(JavaProxy $object, $type)
    {
        $code = strtoupper($type[0]);
        switch ($code) {
            case 'S':
                return $this->invokeMethod(0, 'castToString', [$object]);
            case 'B':
                return $this->invokeMethod(0, 'castToBoolean', [$object]);
            case 'L':
            case 'I':
                return $this->invokeMethod(0, 'castToExact', [$object]);
            case 'D':
            case 'F':
                return $this->invokeMethod(0, 'castToInExact', [$object]);
            case 'N':
                return null;
            case 'A':
                return $this->invokeMethod(0, 'castToArray', [$object]);
            case 'O':
                return $object;
            default:
                throw new Exception\RuntimeException("Illegal type '$code' for casting");
        }
    }
779471
public function setObjectType($type)
    {
        if (!is_null($type)) {
            $type = (string) $type;
        }

        $this->objectType = $type;
        return $this;
    }
128020
public function bind($bindObject) {
        // Loop over object and set property value
        foreach ($bindObject as $key => $value) {
            ObjectUtils::setNestedObjectProperty($value, $this, $key);
        }
    }
47973
public function setProperty(&$object, $propertyName, $propertyValue)
    {
        $property = $this->getPropertyInstance($object, $propertyName);
        $property->setAccessible(true);
        $property->setValue($object, $propertyValue);
    }
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);
    }
986304
private void addType(Class<?> type, Object object)
    {
        if (!items.containsKey(type))
        {
            items.put(type, new HashSet<>());
        }
        items.get(type).add(object);
    }
36532
public function handleStorage($fieldObject)
    {
        $type = $fieldObject->getStorageType();
        $typeName = $type->getName();
        if ($typeName === 'json') {
            /** @deprecated since 3.3 to be renamed in v4. */
            $typeName = 'json_array';
        }
        $typeCol = 'value_' . $typeName;
        $this->$typeCol = $this->getValue();
    }
392987
protected function createObject($object)
    {
        $type = new ObjectType(['class'=>get_class($object)]);

        foreach (get_object_vars($object) as $property=>$value) {
            $type[$property] = $this->toType($value);
        }

        return $type;
    }
8208
private function createValue($object, $arguments = [])
    {

        if ($this->isInstanceOf($arguments, ConfigObject::class)) {
            $arguments = $arguments->toArray();
        }

        if (!$this->isArray($arguments)) {
            throw new ServiceManagerException(ServiceManagerException::INVALID_SERVICE_ARGUMENTS_TYPE, [$object]);
        }

        if (!$this->isString($object)) {
            return $object;
        }

        $object = $this->str($object);

        if ($object->startsWith('@')) {
            return ServiceManager::getInstance()->getService($object->trimLeft('@')->val());
        } else {
            $value = $object->val();
            if (class_exists($value)) {
                $reflection = new \ReflectionClass($value);

                return $reflection->newInstanceArgs($arguments);
            }

            return $value;
        }
    }
1091748
public static function setPropertiesValues($object, array $propertiesValues)
    {
        /*
         * No properties?
         * Nothing to do
         */
        if (empty($propertiesValues)) {
            return;
        }

        foreach ($propertiesValues as $property => $value) {
            static::setPropertyValue($object, $property, $value);
        }
    }