Update an item in storage.

@param  StorableInterface $item       The object to update.
@param  array             $properties The list of properties to update, if not all.
@return boolean TRUE if the item was updated, otherwise FALSE.
775638
public function updateItem(StorableInterface $item, array $properties = null)
    {
        if ($item !== null) {
            $this->setModel($item);
        }
        $model  = $this->model();
        $table  = $this->table();
        $struct = array_keys($this->tableStructure());
        $fields = $this->getModelFields($model, $properties);

        $updates = [];
        $binds   = [];
        $types   = [];
        foreach ($fields as $field) {
            $key = $field->ident();
            if (in_array($key, $struct)) {
                if ($key !== $model->key()) {
                    $param = ':'.$key;
                    $updates[] = '`'.$key.'` = '.$param;
                }
                $binds[$key] = $field->val();
                $types[$key] = $field->sqlPdoType();
            } else {
                $this->logger->debug(
                    sprintf('Field "%s" not in table structure', $key)
                );
            }
        }
        if (empty($updates)) {
            $this->logger->warning(
                'Could not update items. No valid fields were set / available in database table.',
                [
                    'properties' => $properties,
                    'structure'  => $struct
                ]
            );
            return false;
        }

        $binds[$model->key()] = $model->id();
        $types[$model->key()] = PDO::PARAM_STR;

        $query = '
            UPDATE
                `'.$table.'`
            SET
                '.implode(", \n\t", $updates).'
            WHERE
                `'.$model->key().'`=:'.$model->key().'';

        $driver = $this->db()->getAttribute(PDO::ATTR_DRIVER_NAME);
        if ($driver == self::MYSQL_DRIVER_NAME) {
            $query .= "\n".'LIMIT 1';
        }

        $result = $this->dbQuery($query, $binds, $types);

        if ($result === false) {
            return false;
        } else {
            return true;
        }
    }
1001074
public function saveData($item)
    {
        $attributes = $item->dataProperties->getAttributesForSave($item->id);
        if(empty($attributes)) return false;

        $classData = static::getClassData();

        foreach ($attributes as $slug => $values)
        {

            $classData::deleteAll(['item_id' => $item->id, 'property_slug' => $slug]);
            $values = (is_array($values)) ? $values : [$values];

            foreach ($values as $value){

                $value = (is_array($value)) ? array_values($value)[0] : $value;

                $data = new $classData;
                $data->value = $value;
                $data->property_slug = $slug;
                $data->item_id = $item->id;
                if(!empty($value)) $data->save();
            }
        }
    }
1133747
protected function persist(Item $item)
    {
        $this->em->persist($item);
        foreach ($item->getNames() as $name) {
            $this->em->persist($name);
        }
        foreach ($item->getSources() as $source) {
            $this->em->persist($source);
        }
    }
1186944
public function set(ItemInterface $item)
    {
        $id = $item->getId();
        $collectionName = $item->getCollection();

        $this->items[$id] = $item;

        if (isset($this->idCollections[$id]) && $this->idCollections[$id] !== $collectionName) {
            throw new \RuntimeException(sprintf('The item with id: "%s" has been registered previously with another collection.', $id));
        }

        if (isset($this->itemCollections[$collectionName]) === false) {
            $this->itemCollections[$collectionName] = [];
        }

        $this->itemCollections[$collectionName][$id] = $item;
        $this->idCollections[$id] = $collectionName;
    }
1066521
public function doSerialize(EventInterface $event)/*# : bool */
    {
        /* @var CacheItem $item */
        $item = $event->getParam('item');
        $item->setStrVal(serialize($item->get()));
        return true;
    }
479018
public function saveDeferred(CacheItemInterface $item)
    {
        $key = spl_object_id($item);

        if ( ! array_key_exists($key, $this->deferred)) {
            $this->deferred[] = $item;

            return true;
        }

        return false;
    }
825373
public function addItem(ItemInterface $item)
    {
        if ($this->hasItem($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous item exists with the same id: "%s".', $item->getId()));
        }

        $this->items[$item->getId()] = $item;
    }
1333545
public function isSatisfiedBy($item): bool
    {
        return $this->one->isSatisfiedBy($item) && $this->two->isSatisfiedBy($item);
    }
1274067
public function update(ProductsRequest $request, $item)
	{
		$this->products->update(
			$request->all(), $item
		);

		return back()->with('status', trans('globals.success_text'));
	}
844802
public function isCached(CacheItemInterface $item = null)
    {
        if (!$item) {
            $key = $this->getCurrentKey();
            $item = $this->getItemStorage()->get($key);
        }

        return $item ? true : false;
    }
136458
public function add(ItemInterface $item)
    {
        $item->setCollection($this);
        $this->items[] = $item;

        return $this;
    }
724554
public function update($item)
    {
        $item['profile'] = encodeOptions($item['profile']);
        $result = Eresus_CMS::getLegacyKernel()->db->
            updateItem($this->table, $item, "`id`={$item['id']}");
        return $result;
    }
538999
final public function update(array $keys = null)
    {
        $pre = $this->preUpdate($keys);
        if ($pre === false) {
            $this->logger->error(sprintf(
                'Can not update object "%s:%s"; cancelled by %s::preUpdate()',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        $ret = $this->source()->updateItem($this, $keys);
        if ($ret === false) {
            $this->logger->error(sprintf(
                'Can not update object "%s:%s"; repository failed for %s',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        $post = $this->postUpdate($keys);
        if ($post === false) {
            $this->logger->warning(sprintf(
                'Updated object "%s:%s" but %s::postUpdate() failed',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        return true;
    }
487665
public function addItem($item)
    {
        if (!$this->getItems()) {
            return $this->setItems(array($item));
        } else {
            return $this->setItems(
                array_merge($this->getItems(), array($item))
            );
        }
    }
735119
public function update(EntityInterface $entity, array $commandOptions = array())
    {
        $this->dispatchEntityRequestEvent(Events::ENTITY_PRE_UPDATE, $entity);

        $commandOptions += $this->formatPutItemCommandOptions($entity, true);
        $model = $this->dynamoDb->putItem($commandOptions);

        $this->dispatchEntityResponseEvent(Events::ENTITY_POST_UPDATE, $entity, $model);
        return true;
    }
1061267
public function save(CacheItemInterface $item)
    {
        $key = $item->getKey();

        $this->validateKey($key);

        $data = serialize($item);

        $result = file_put_contents($this->getPath($key), $data);

        if ($result === false) {
            return false;
        }

        return true;
    }
687211
public function remove(CacheableInterface $item)
    {
        if (isset($this->values[$item->getHashKey()])) {
            unset($this->values[$item->getHashKey()]);
        }
    }