Links a given ID to this session.

@param int $fileId
@return $this
504520
public function link($fileId)
    {
        $links = session(static::SESSION_KEY, []);

        $links[ $fileId ] = true;

        session()->put(static::SESSION_KEY, $links);

        return $this;
    }
273944
public function removeAction($fileId = null)
    {
        if (!$fileId) {
            return new Response('Please provide a file id', 500);
        }

        $manager = $this->getDoctrine()->getManager();
        $repo = $this->getDoctrine()->getRepository('LibrinfoMediaBundle:File');

        $file = $repo->findOneBy([
            'id'    => $fileId,
        ]);

        if ($file !== null) {
            if ($file->isOwned()) {
                $dispatcher = $this->get('event_dispatcher');
                $event = new GenericEvent($file);
                $dispatcher->dispatch(UploadControllerEventListener::REMOVE_ENTITY, $event);
            }

            $name = '' . $file->getName();
            $manager->remove($file);
            $manager->flush();

            return new Response($name . ' removed successfully', 200);
        } else {
            return new Response('the file cannot be removed', 401);
        }
    }
485095
private function _login($id){
    if ( $this->check() && $id ){
      $this
        ->_authenticate($id)
        ->_user_info()
        ->_init_dir(true)
        ->save_session();
    }
    return $this;
  }
1125254
public function setSessionID(string $session_id)
    {
        if (!defined('WEDETO_TEST') || WEDETO_TEST === 0)
            throw new \RuntimeException("Cannot change the session ID");

        $this->session_id = $session_id;
        return $this;
    }
1192973
public function createPHPSession($sessionID = true)
    {
        if ($sessionID) {
            $_SESSION[$this->_sessionName] = $this->_session;
        }
        return $this;
    }
1238126
public function setSessionId($session_id=null)
    {
        $this->session_id= ($session_id!== null) ? $session_id : null;

        return $this;
    }
459490
public function setDocumentId($documentId)
    {
        if (preg_match($this->getDocumentIdRegex(), $documentId)) {
            $this->document_id = $documentId;

            return $this;
        }

        throw new InvalidArgument(
            'document_id must be a string with 10 alphanumeric letters.' .
                     '5 letters, followed by 4 numbers, followed by 1 letter or number. Example: ABCDE1234F'
        );
    }
1277417
public function deleteById($id)
    {
        $model = $this->getById($id);

        if (empty($model))
            return $this;

        if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
            $fileAttrName = $this->fileAttrName;
            $modelFiles = $model->$fileAttrName;

            foreach ($modelFiles as $file)
                $this->deleteFileByData($model->id, $file['file_log_id']);
        }

        $model->delete();

        if ($this->canOrder())
            $this->resetOrder();

        return $this;
    }
895459
public function setId($Id) 
    {
        if (!$this->_isNumericArray($Id)) {
            $Id =  array ($Id);    
        }
        $this->fields['Id']['FieldValue'] = $Id;
        return $this;
    }
1299057
public function setId($id = null)
    {
        $this->id = ($id !== null) ? $id : SecureKey::generate();

        return $this;
    }
171579
public function setId($id)
    {
        if (!empty($id) && is_string($id) && ctype_print($id)) {
            $this->id = trim($id);
        }

        return $this;
    }
1113221
public function setAppId($appId)
    {
        $element = new Element('meta');

        $element->attributes[ 'name' ] = 'fb:app_id';
        $element->attributes[ 'content' ] = $appId;

        parent::offsetSet('fb:app_id', $element);

        return $this;
    }
626699
private function setFile(string $id)
    {
        if (!$this->id || $id != $this->id) {
            $this->id = $id;
            $id = Check::name($id, ["#"]);
            $this->file = (preg_match("/^" . preg_quote(PATH_HOME, '/') . "/i", $id) ? $id : PATH_HOME . "_cdn/" . parent::getFolder() . "/{$id}");

            // Verifica se é final .json
            if (!preg_match("/\.json$/i", $id))
                $this->file .= ".json";
        }
    }
564916
private function getInput($fileId)
    {
        $volumeManager = $this->getContainer()->get('phlexible_media_manager.volume_manager');
        $volume = $volumeManager->getByFileId($fileId);
        $file = $volume->findFile($fileId);

        return InputDescriptor::fromFile($file);
    }
75344
public function move($fileIDs, $parentID)
    {
        if (is_array($fileIDs)) {
            $fileIDs = implode(',', $fileIDs);
        }

        $data = [
            'file_ids'  => $fileIDs,
            'parent_id' => $parentID
        ];

        return $this->post('files/move', $data, \true);
    }
952121
public function setAttachmentId($id)
    {
        $this->payload['attachment_id'] = $id;
        unset($this->payload['url'], $this->payload['is_reusable']);

        return $this;
    }
202012
protected function removeVariant($fileID)
    {
        $parsedFiledID = $this->getPublicResolutionStrategy()->parseFileID($fileID);
        if ($parsedFiledID) {
            return $this->getPublicResolutionStrategy()->buildFileID($parsedFiledID->setVariant(''));
        }

        return $fileID;
    }