public function markJobFailed($id, $message = null)
    {
        $entity = $this->get($id);
        $data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]];
        $this->patchEntity($entity, $data, ['validate' => false]);
        return $this->save($entity);
    }
public function markJobFailed($id, $message = null)
    {
        $entity = $this->get($id);
        $data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]];
        $this->patchEntity($entity, $data, ['validate' => false]);
        return $this->save($entity);
    }
public function markJobFailed ( $ id , $ message = null ) { $ entity = $ this -> get ( $ id ) ; $ data = [ 'completed' => false , 'stats' => [ 'tries' => ( $ entity -> stats [ 'tries' ] + 1 ) , 'message' => $ entity -> stats [ 'message' ] . ( $ entity -> stats [ 'tries' ] + 1 ) . '. ' . $ message . PHP_EOL ] ] ; $ this -> patchEntity ( $ entity , $ data , [ 'validate' => false ] ) ; return $ this -> save ( $ entity ) ; }
Job did not complete, save a few stats so we can see what went wrong.

@param $id
@param null $message
@return bool|\Cake\Datasource\EntityInterface|mixed
Job did not complete save a few stats so we can see what went wrong .