Update an element

@param BaseResource $object
@param boolean $flushed
@return BaseResource
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;
    }
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);
    }
945990
public function delete($object)
	{
		$deleted = $object->delete();

		if( ! $deleted)
		{
			return new Payload($object, 'not_deleted');
		}

		// Remove the deleted model from cache.
		Cache::tags($this->model->getTable())->flush($updated->getKey());

		return new Payload(null, 'deleted');
	}
22705
public function persist($object, $flush = true)
    {
        if ($object->getId()) {
            $this->update($object, $flush);
        } else {
            $this->create($object, $flush);
        }
    }
960031
public function redirectTo($object)
    {
        $url = false;

        if ($this->getRequest()->get('btn_update_and_list')) {
            $url = $this->admin->generateUrl('list', ['active_tab' => $this->getRequest()->get('context')]);
        }
        if ($this->getRequest()->get('btn_create_and_list')) {
            $url = $this->admin->generateUrl('list', ['active_tab' => $this->getRequest()->get('context')]);
        }

        if ($this->getRequest()->get('btn_create_and_create')) {
            $params = [];
            if ($this->admin->hasActiveSubClass()) {
                $params['subclass'] = $this->getRequest()->get('subclass');
            }
            $url = $this->admin->generateUrl('create', $params);
        }

        if (!$url) {
            $url = $this->admin->generateObjectUrl('edit', $object);
        }

        return new RedirectResponse($url);
    }
179683
public function hydrate(array $data, $object)
    {
        if (!$object instanceof TicketSubject) {
            throw new \InvalidArgumentException('$object must be an instance of TicketSubject');
        }

        return parent::hydrate($data, $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');
	}
37045
protected function redirectTo($object)
    {
        $request = $this->getRequest();

        $url = false;

        if (null !== $request->get('btn_update_and_list')) {
            $url = $this->admin->generateUrl('list');
        }
        if (null !== $request->get('btn_create_and_list')) {
            $url = $this->admin->generateUrl('list');
        }

        if (null !== $request->get('btn_create_and_create')) {
            $params = array();
            if ($this->admin->hasActiveSubClass()) {
                $params['subclass'] = $request->get('subclass');
            }
            $url = $this->admin->generateUrl('create', $params);
        }

        if ($this->getRestMethod() === 'DELETE') {
            $url = $this->admin->generateUrl('list');
        }

        if (!$url) {
            foreach (array('show', 'edit') as $route) {
                if ($this->admin->hasRoute($route) && $this->admin->hasAccess($route,
                        $object)) {
                    $url = $this->admin->generateObjectUrl($route, $object);

                    break;
                }
            }
        }

        if (!$url) {
            $url = $this->admin->generateUrl('list');
        }

        return new RedirectResponse($url);
    }
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);
	}
1228134
@Override
    public void update(Number obj) {
        if (enable == false) {
            return;
        }

        if (intervalCheck.check()) {
            flush();
        }
        synchronized (this) {
            unflushed = updater.update(obj, unflushed);
        }
    }
1021143
public function hydrate($object, $data)
    {
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                // Check setMethod
                if (!$this->callSetter($object, $this->toCamelCase($key), $value)) {
                    // If no setter is defined, we reinject into array
                    $data[$key] = $value; // Change data with subObject
                }
            }
        }

        return $object;
    }
89745
public function update($object, $meta=null)
    {
        $query = new Query\Update();
        if (!is_object($object)) {
            throw new \BadMethodCallException("Please use updateTable()");
        } 

        if ($meta) {
            $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
        } else {
            $meta = $this->mapper->getMeta(get_class($object));
        }

        if (!$meta->primary) {
            throw new Exception("Cannot update: meta {$meta->id} has no primary key");
        }
        if (!$meta->canUpdate) {
            throw new Exception("Meta {$meta->id} prohibits update");
        }

        event_before: {
            if (isset($meta->on['beforeUpdate'])) {
                foreach ($meta->on['beforeUpdate'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['beforeUpdate'])) {
                foreach ($this->on['beforeUpdate'] as $cb) { $cb($object, $meta); }
            }
        }

        query: {
            $query->set = $this->mapper->mapObjectToRow($object, $meta, 'update');
            $query->where = $meta->getIndexValue($object);

            list ($sql, $params, $props) = $query->buildQuery($meta);
            // don't need to do formatParams - it's already covered by the mapPropertiesToRow call in
            // table update mode

            $return = $this->getConnector()->exec($sql, $params);
        }

        event_after: {
            if (isset($meta->on['afterUpdate'])) {
                foreach ($meta->on['afterUpdate'] as $cb) { $cb = [$object, $cb]; $cb(); }
            }
            if (isset($this->on['afterUpdate'])) {
                foreach ($this->on['afterUpdate'] as $cb) { $cb($object, $meta); }
            }
        }
        return $return;
    }
1245510
public function update($data, $object)
	{
		$updated = $object->update($data);

		// @todo: Double Check that we should be returning updated not object
		if( ! $updated)
		{
			return new Payload($object , 'not_updated');
		}

		return new Payload($object, 'updated');
	}
1179605
public static function update($request, $object)
    {
        // request param
        $backend = Pluf::f('marketplace.backend', 'http://marketplace.webpich.com');
        $path = '/api/v2/marketplace/spas/' . $object->name . '/file';
        $file = Pluf::f('temp_folder', '/tmp') . '/spa-' . rand();
        // Do request
        $client = new GuzzleHttp\Client();
        $response = $client->request('GET', $backend . $path, [
            'sink' => $file
        ]);
        return Tenant_SpaService::updateFromFile($object, $file, true);
    }
1100009
private static function mapResource($resource, $object)
    {
        if ($object == false || is_string($object)) {
            return $object;
        }

        $baseResource = __NAMESPACE__ . '\\' . $resource;
        $class = (class_exists($baseResource)) ? $baseResource : 'Bigcommerce\\Api\\Resources\\' . $resource;
        return new $class($object);
    }
1097412
public function save($object, $flush = true)
    {
        $this->isExpectedObject($object);
        $this->objectManager->persist($object);
        if ($flush) {
            $this->flush();
        }
    }
981066
final public function save(BaseEntityInterface $entity, $flush = false): self
    {
        $this->_em->persist($entity);

        if (true === $flush) {
            $this->_em->flush();
        }

        return $this;
    }