Update or crate a record and return the entity

@param array $identifiers columns to search for
@param array $data
@return mixed
11512
public function updateOrCreate(array $identifiers, array $data)
    {
        $existing = $this->model->where(array_only($data, $identifiers))->first();

        if ($existing) {
            $existing->update($data);

            return $existing;
        }

        return $this->create($data);
    }
1277173
public function update(array $data, $primaryKey)
    {
        $this->normalizeDataColumns($data);

        $this->setSearchIndexableData($data);

        return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]);
    }
8781
public function update($identifier, array $attributes = [])
    {
        return $this->mediator->transform($this->mediator(func_get_args()))->first();
    }
698576
public function loadTypeDataByIdentifier($identifier, $status)
    {
        try {
            return $this->innerGateway->loadTypeDataByIdentifier($identifier, $status);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1102050
public function set($identifier, $data = null)
    {
        if($data == null) {
            $data = is_string($identifier) ? new KObjectIdentifier($identifier) : $identifier;
        }

        $this->offsetSet((string) $identifier, $data);
        return $data;
    }
1061718
public function getRetrieveCritiera(EntityMetadata $metadata, $identifiers = null)
    {
        $criteria = [];
        if (true === $metadata->isChildEntity()) {
            $criteria[Persister::POLYMORPHIC_KEY] = $metadata->type;
        } elseif (true === $metadata->isPolymorphic() && false === $metadata->isAbstract()) {
            $criteria[Persister::POLYMORPHIC_KEY] = $metadata->type;
        }

        $identifiers = (array) $identifiers;
        if (empty($identifiers)) {
            return $criteria;
        }
        $criteria[Persister::IDENTIFIER_KEY] = (1 === count($identifiers)) ? reset($identifiers) : $identifiers;
        return $criteria;
    }
1355181
public function registerManaged($document, $identifier, array $data)
    {
        $oid                              = spl_object_hash($document);
        $this->documentIdentifiers[$oid]  = $identifier !== null ? $identifier : $oid;
        $this->documentStates[$oid]       = self::STATE_MANAGED;
        $this->originalDocumentData[$oid] = $data;
        $this->addToIdentityMap($document);
    }
971380
public function update($identifier, array $attributes = [])
    {
        $instance = $identifier instanceof Eloquent
            ? $identifier
            : $this->repository->makeQuery()->findOrFail($identifier);

        $instance->fill($attributes);

        if ($instance->isDirty()) {
            $instance->save();
        }

        return $instance;
    }
1012926
public function getContentByIds(array $identifiers)
    {
        $items = array();

        foreach ($identifiers as $id) {

            $items[$id] = $this->getContentById($id);
        }

        return $items;
    }
810427
public function update($id, array $data)
    {
        $model = $this->model->find($id);
        $model->fill($data);
        $model->save();

        return $model;
    }
721320
protected function updateByEntity($data, $entity)
	{
		return $this->aggregate[$entity->getType(true)]->update($data, $entity);
	}
526698
protected function find($identifiers, $targetClass)
    {
        if ($identifiers instanceof $targetClass) {
            return $identifiers;
        }

        if ($this->isNullIdentifier($identifiers)) {
            return null;
        }

        return $this->objectManager->find($targetClass, $identifiers);
    }
507280
public function findByIds(array $ids)
    {
        $entities = [];

        for ($i = 0; $i < count($this->registries); $i++) {
            /** @var RegistryInterface $registry */
            $registry = $this->registries[ $i ];
            $found = $registry->findByKeys($ids);
            $entities = array_merge($entities, $found);

            $this->updateRegistries($found, $i - 1);

            if (count($entities) === count($ids)) {
                break;
            }
        }

        return $entities;
    }
249641
public function batchEdit(array $ids, array $properties)
    {
        $this->getEntityDao()->beginTransaction();

        try {
            foreach ($ids as $id) {
                /** @var EntityDao $dao */
                $dao = $this->createDao();
                $dao->find($id);

                foreach ($properties as $key => $value) {
                    $dao->$key = $value;
                }

                $dao->update();
            }

            $this->getEntityDao()->commit();
        } catch (Exception $e) {
            $this->getEntityDao()->rollBack();

            throw new UpdateException ('Batch edit was not successful: ' . $e->getMessage());
        }


        return $this;
    }
570132
public function setPreRelease(array $identifiers)
    {
        foreach ($identifiers as $identifier) {
            if (!Validator::isIdentifier($identifier)) {
                throw new InvalidIdentifierException($identifier);
            }
        }

        $this->preRelease = $identifiers;

        return $this;
    }
980446
protected function _update($id, array $data)
    {
        return $this->db->update($this->table, $data, ['id' => $id]);
    }
967282
public function retrieveById($identifier) {
        if (!$this->isValidIdentifierValue($identifier)) {
            return null;
        }
        /** @var RecordInterface $user */
        $user = $this->createEmptyUserRecord()->fromPrimaryKey($identifier, [], $this->getRelationsToFetch());

        return $this->validateUser($user, null);
    }