public function toArray()
    {
        $data = parent::toArray();

        $deniedCategories = [
            TaskLogInterface::CATEGORY_DELETE,
            TaskLogInterface::CATEGORY_EXPORT,
            TaskLogInterface::CATEGORY_UNKNOWN
        ];

        if ( !in_array($this->taskLogService->getCategoryForTask($this->getTaskName()), $deniedCategories) &&
             ($this->getStatus()->isCompleted() || $this->getStatus()->isArchived()) ) {

            $user = $this->user;
            $params = [
                'taskId' => $this->getId()
            ];
            $hasAccess = $this->hasAccess(
                $user,
                Redirector::class,
                'redirectTaskToInstance',
                $params
            );
            if ($hasAccess) {
                $data = array_merge($data, [
                    'redirectUrl' => _url('redirectTaskToInstance', 'Redirector', 'taoBackOffice', $params)
                ]);
            } else {
                \common_Logger::w('User \''.$user->getIdentifier().'\' does not have access to redirectTaskToInstance');
            }
        }

        return $data;
    }
public function toArray()
    {
        $data = parent::toArray();

        $deniedCategories = [
            TaskLogInterface::CATEGORY_DELETE,
            TaskLogInterface::CATEGORY_EXPORT,
            TaskLogInterface::CATEGORY_UNKNOWN
        ];

        if ( !in_array($this->taskLogService->getCategoryForTask($this->getTaskName()), $deniedCategories) &&
             ($this->getStatus()->isCompleted() || $this->getStatus()->isArchived()) ) {

            $user = $this->user;
            $params = [
                'taskId' => $this->getId()
            ];
            $hasAccess = $this->hasAccess(
                $user,
                Redirector::class,
                'redirectTaskToInstance',
                $params
            );
            if ($hasAccess) {
                $data = array_merge($data, [
                    'redirectUrl' => _url('redirectTaskToInstance', 'Redirector', 'taoBackOffice', $params)
                ]);
            } else {
                \common_Logger::w('User \''.$user->getIdentifier().'\' does not have access to redirectTaskToInstance');
            }
        }

        return $data;
    }
public function toArray ( ) { $ data = parent :: toArray ( ) ; $ deniedCategories = [ TaskLogInterface :: CATEGORY_DELETE , TaskLogInterface :: CATEGORY_EXPORT , TaskLogInterface :: CATEGORY_UNKNOWN ] ; if ( ! in_array ( $ this -> taskLogService -> getCategoryForTask ( $ this -> getTaskName ( ) ) , $ deniedCategories ) && ( $ this -> getStatus ( ) -> isCompleted ( ) || $ this -> getStatus ( ) -> isArchived ( ) ) ) { $ user = $ this -> user ; $ params = [ 'taskId' => $ this -> getId ( ) ] ; $ hasAccess = $ this -> hasAccess ( $ user , Redirector :: class , 'redirectTaskToInstance' , $ params ) ; if ( $ hasAccess ) { $ data = array_merge ( $ data , [ 'redirectUrl' => _url ( 'redirectTaskToInstance' , 'Redirector' , 'taoBackOffice' , $ params ) ] ) ; } else { \ common_Logger :: w ( 'User \'' . $ user -> getIdentifier ( ) . '\' does not have access to redirectTaskToInstance' ) ; } } return $ data ; }
Add 'redirectUrl' to the result if the task has been processed
and it is not an export or delete task

@return array
Add redirectUrl to the result if the task has been processed and it is not an export or delete task