Patches a property in `object`.

@param object $object   - the entity to update
@param string $property - the property to update
@param mixed  $data     - the data that must be set
@param array  $options  - an array of options
7968
public function replace($object, $property, $data, array $options = [])
    {
        $methodName = 'set'.ucfirst($property);

        if (!method_exists($object, $methodName)) {
            throw new \LogicException(
                sprintf('You have requested a non implemented action \'set\' on %s (looked for %s)', get_class($object), $methodName)
            );
        }

        //add the options to pass on here
        $this->checkPermission('PATCH', $object, [], true);
        //we'll need to pass the $action and $data here aswell later
        if ($this->dispatch('patch', 'pre', [$object, $options, $property, $data, self::PROPERTY_SET])) {
            $object->$methodName($data);

            $this->om->save($object);
            $this->dispatch('patch', 'post', [$object, $options, $property, $data, self::PROPERTY_SET]);
        }
    }
905596
protected static function configObject($object, array $options)
    {
        $options = self::checkOptions($options);
        foreach ($options as $name => $value) {
            $methodName = 'set' . ucfirst($name);
            if (!method_exists($object, $methodName)) {
                continue;
            }
            $object->$methodName($value);
        }

        return $object;
    }
84164
public function update($object)
    {
        if ($this->isNewObject($object)) {
            throw new UnknownObjectException('The object of type "' . get_class($object) . '" (identifier: "' . $this->getIdentifierByObject($object) . '") which was passed to EntityManager->update() is not a previously persisted object. Check the code which updates this entity and make sure that only objects are updated which were persisted before. Alternatively use add() for persisting new objects."', 1313663277);
        }
        try {
            $this->entityManager->persist($object);
        } catch (\Exception $exception) {
            throw new PersistenceException('Could not merge object of type "' . get_class($object) . '"', 1297778180, $exception);
        }
    }
1160491
public static function setDataOptionAttributes($data, $object)
    {
        if(is_array($data) && count($data) > 0)
        {
            $keys = array_keys($data);

            $response = '';
            foreach($keys as $key)
            {
                $response .= ' data-' . $key . '="' . $object->{$data[$key]} . '"';
            }

            return $response;
        }

        return null;
    }
100901
public function settingsValidate(Event $event, array $data, ArrayObject $options)
    {
        if (!empty($options['entity']) && $options['entity']->has('handler')) {
            $block = $options['entity'];

            if (!$block->isCustom()) {
                $validator = new Validator();
                $block->validateSettings($data, $validator);
                $errors = $validator->errors((array)$data);
                foreach ($errors as $k => $v) {
                    $block->errors("settings:{$k}", $v);
                }
            }
        }
    }
1344451
public function update($document, array $options = array())
    {
        $update = $this->pb->prepareUpdateData($document);

        $query = $this->getQueryForDocument($document);

        foreach (array_keys($query) as $field) {
            unset($update['$set'][$field]);
        }

        if (empty($update['$set'])) {
            unset($update['$set']);
        }

        if ( ! empty($update)) {
            // Include versioning logic to set the new version value in the database
            // and to ensure the version has not changed since this document object instance
            // was fetched from the database
            if ($this->class->isVersioned) {
                $versionMapping = $this->class->fieldMappings[$this->class->versionField];
                $currentVersion = $this->class->reflFields[$this->class->versionField]->getValue($document);
                if ($versionMapping['type'] === 'int') {
                    $nextVersion = $currentVersion + 1;
                    $update['$inc'][$versionMapping['name']] = 1;
                    $query[$versionMapping['name']] = $currentVersion;
                    $this->class->reflFields[$this->class->versionField]->setValue($document, $nextVersion);
                } elseif ($versionMapping['type'] === 'date') {
                    $nextVersion = new \DateTime();
                    $update['$set'][$versionMapping['name']] = new \MongoDate($nextVersion->getTimestamp());
                    $query[$versionMapping['name']] = new \MongoDate($currentVersion->getTimestamp());
                    $this->class->reflFields[$this->class->versionField]->setValue($document, $nextVersion);
                }
            }

            // Include locking logic so that if the document object in memory is currently
            // locked then it will remove it, otherwise it ensures the document is not locked.
            if ($this->class->isLockable) {
                $isLocked = $this->class->reflFields[$this->class->lockField]->getValue($document);
                $lockMapping = $this->class->fieldMappings[$this->class->lockField];
                if ($isLocked) {
                    $update['$unset'] = array($lockMapping['name'] => true);
                } else {
                    $query[$lockMapping['name']] = array('$exists' => false);
                }
            }

            $result = $this->collection->update($query, $update, $options);

            if (($this->class->isVersioned || $this->class->isLockable) && ! $result['n']) {
                throw LockException::lockFailed($document);
            }
        }
    }
554411
public function hydrate(array $data, $object)
    {
        if (!is_object($object)) {
            throw new RuntimeException(
                sprintf('%s expects the provided $object to be a PHP object', __METHOD__)
            );
        }

        return (function (array $data) {
            foreach ($data as $property => $value) {
                if (!property_exists($this, $property)) {
                    throw new RuntimeException(
                        sprintf(
                            'Property "%s" does not exist in "%s" class.',
                            $property,
                            get_class($this)
                        )
                    );
                }

                $this->{$property} = $value;
            }

            return $this;
        })->call($object, $data);
    }
963374
protected function setPropertyValue($object, \ReflectionProperty $property, $value)
    {
        if ($value !== null) {
            // If the property is public accessible, set the value directly
            if ($property->isPublic()) {
                $object->{$property->name} = $value;
            } else {
                // If not, use the setter / adder
                $ucw = ucwords($property->name);
                if ($property->getDeclaringClass()->hasMethod($method = 'set' . $ucw)) {
                    $object->$method($value);
                } elseif ($property->getDeclaringClass()->hasMethod($method = 'add' . $ucw)) {
                    $object->$method($value);
                }
            }
        }
    }
369145
public function hydrate($object, $data, $prefix)
    {
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                // Check setMethod
     //           print_r(strrpos($key, $prefix));
                if (strrpos($key, $prefix) !== false && !$this->callSetter($object, $this->format($key, $prefix), $value)) {
                    // If no setter is defined, we reinject into array
                    $data[$key] = $value; // Change data with subObject
                }
            }
        }

        return $object;
    }
627899
public function update($data, $object)
	{
		// Process data given.
		$processPayload = $this->process(__FUNCTION__, $data);

		if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		{
			return $processPayload;
		}

		return $this->dataSource->update($processPayload->getData(), $object);
	}
17677
public function updateFromObject(stdClass $object)
    {

        $this->name  = property_exists($object, 'name') ? $object->name : null;
        $this->email = property_exists($object, 'email') ? $object->email : null;
    }
273164
public function set(array $data, array $options = []) {
		$defaults = ['init' => false];
		$options += $defaults;

		$cast = ($schema = $this->schema());

		foreach ($data as $key => $val) {
			unset($this->_increment[$key]);
			if (strpos($key, '.')) {
				$this->_setNested($key, $val);
				continue;
			}
			if ($cast) {
				$pathKey = $this->_pathKey;
				$model = $this->_model;
				$parent = $this;
				$val = $schema->cast($this, $key, $val, compact('pathKey', 'model', 'parent'));
			}
			if ($val instanceof self) {
				$val->_exists = $options['init'] && $this->_exists;
				$val->_pathKey = ($this->_pathKey ? "{$this->_pathKey}." : '') . $key;
				$val->_model = $val->_model ?: $this->_model;
				$val->_schema = $val->_schema ?: $this->_schema;
			}
			$this->_updated[$key] = $val;
		}
	}
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);
    }
661886
public function removeObject(DataObject $object)
    {
        $item = ChangeSetItem::get()->filter([
            'ObjectID' => $object->ID,
            'ObjectClass' => $object->baseClass(),
            'ChangeSetID' => $this->ID
        ])->first();

        if ($item) {
            // TODO: Handle case of implicit added item being removed.

            $item->delete();
        }

        $this->sync();
    }
239327
function setData($object, array $data)
    {
        if (! $this->has($object) )
            throw new \Exception('Object Not Found.');

        if ($data == array_values($data))
            throw new \InvalidArgumentException('Data tags must be associative array.');


        $hash = $this->genETag($object);
        $this->_objs[$hash]['data'] = $data;
        return $this;
    }
1214128
public function patch($path = null, $data = [], array $options = []) {
		return $this->send(__FUNCTION__, $path, $data, $options);
	}
877084
public function setPropertyValue( core_kernel_classes_Property $property, $object)
    {
        $returnValue = (bool) false;
        $returnValue = $this->getImplementation()->setPropertyValue($this, $property, $object);
        $this->onUpdate();
        return (bool) $returnValue;
    }