Mark job done and add some stats

@param $id
@return bool|\Cake\Datasource\EntityInterface|mixed
545835
public function markJobDone($id)
    {
        $entity = $this->get($id);
        $data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]];
        $this->patchEntity($entity, $data, ['validate' => false]);
        return $this->save($entity);
    }
487981
public function destroy($id)
    {
        $this->_table->delete(new Entity(
            [$this->_table->getPrimaryKey() => $id],
            ['markNew' => false]
        ));

        return true;
    }
1071943
protected function __apiUpdate(string $id)
    {
        $record = Galleries::findOrFail($id);

        $data = $this->getInputData();

        $record->update(array_get($data, 'record'));
        $record->updateTranslations(array_get($data, 'translations'));
        $record->images()->sync(array_get($data, 'images'));


        return $this->apiShow($record->id);
    }
343061
protected function _put($id = null)
    {
        $subject = $this->_subject();
        $subject->set(['id' => $id]);

        $entity = $this->_table()->patchEntity(
            $this->_findRecord($id, $subject),
            $this->_request()->getData(),
            $this->saveOptions()
        );

        $this->_trigger('beforeSave', $subject);
        if (call_user_func([$this->_table(), $this->saveMethod()], $entity, $this->saveOptions())) {
            return $this->_success($subject);
        }

        $this->_error($subject);
    }
1108392
public function runTask($id)
    {
        set_time_limit(0);

        /** @var \Illuminate\Console\Scheduling\Event $event */
        $event = $this->getKernelEvents()[$id - 1];

        $event->sendOutputTo($this->getOutputTo());

        $event->run(app());

        return $this->readOutput();
    }
219617
protected function __apiUpdate(string $id)
    {
        $record = HCMenu::findOrFail($id);

        $data = $this->getInputData();

        $record->forgetMenuCache();

        $record->update(array_get($data, 'record', []));
        $record->menu_groups()->sync(array_get($data, 'menu_groups'));

        $record->forgetMenuCache();

        return $this->apiShow($record->id);
    }
1185606
public function show($id)
    {
        $todo = $this->client->get(
            sprintf('buckets/%d/todos/%d.json', $this->bucket, $id)
        );

        return new Todo($this->response($todo));
    }
396759
public function isCached($id) {
        if ($id != null) {
            $id = $this->getIDfromOjb($id);
        }

        if ($id == null)
            return false;

        $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
        $cachetime = $this->getConfig('cacheTime');

        if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
            return true;
        }

        return false;
    }
960181
public function markEmailAsRead($id) {

        $emailMessage = $this->model->find($id);

        $emailMessage->read = 1;

        return $emailMessage->save();
    }
1061862
protected function doDelete($id) {
    $this->cache_clear_all($this->getCacheId($id), $this->cache_table);
    return TRUE;
  }
35128
public function bookmark($id)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key']
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 201);

		// Set the API base
		$base = '/v1/people/~/job-bookmarks';

		// Build xml.
		$xml = '<job-bookmark><job><id>' . $id . '</id></job></job-bookmark>';

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		$header['Content-Type'] = 'text/xml';

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);

		return $response;
	}
1236389
public function run($id)
    {
        $model = $this->getModel($id);

        if ($model->{$this->methodName}()) {
            $this->addSuccessFlash();
        }

        return $this->redirect($model);
    }
674862
public function edit(string $id)
    {
        $table = $this->loadModel();

        $entity = $this->fetchEntity($id);

        if ($this->request->is(['patch', 'post', 'put'])) {
            $post_data = (array)$this->request->getData();

            // enable accessibility to associated entity's primary key
            // to avoid associated entity getting flagged as new
            $options = $table instanceof Table ? $table->enablePrimaryKeyAccess() : [];

            $response = $this->persistEntity($entity, $post_data, $options);
            if ($response) {
                $this->saveAssociations($entity, $post_data);

                return $response;
            }
        }

        $this->set('entity', $entity);
        $this->render('CsvMigrations.Common/edit');
        $this->set('_serialize', ['entity']);
    }
540691
public function reset($id = null) {
		$fields = [
			'completed' => null,
			'fetched' => null,
			'progress' => 0,
			'failed' => 0,
			'workerkey' => null,
			'failure_message' => null,
		];
		$conditions = [
			'completed IS' => null,
		];
		if ($id) {
			$conditions['id'] = $id;
		}

		return $this->updateAll($fields, $conditions);
	}
421463
public function addTeamRepository(int $id)
    {
        $return = $this->getApi()->request($this->getApi()->sprintf('/teams/:id/repos/:org/:repo', (string)$id,
            $this->getOrganizations()->getOwner(), $this->getOrganizations()->getRepo()), Request::METHOD_PUT);

        if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
            return true;
        }

        return $return;
    }
222225
protected function __apiUpdate(string $id)
    {
        $record = HCCountries::findOrFail($id);
        $record->languages()->sync(array_get($this->getInputData(), 'languages'));

        return $this->apiShow($record->id);
    }
1370371
public function find($id)
    {
        if ($this->refresh) {
            $this->forget($id);
        }
        return $this->cache->remember($this->keyPrefix . $id . implode('-', $this->with), $this->minutesToCache,
            function () use ($id) {
                return $this->decorated->find($id);
            });
    }