skip to Main Content

I have developed a custom TYPO3 extbase extension that was perfectly worked on 8 and 9 version of TYPO3.
Recently I upgraded my installation to TYPO3 10 version but the php based views of my TYPO3 extbase extension do not work anymore.
The error that is displayed is:
Sorry, the requested view was not found.
The technical reason is: No template was found. View could not be resolved for action "getIcal" in class "LucLucevents2ControllerEventController"

I have read the instructions in the page
https://docs.typo3.org/m/typo3/book-extbasefluid/10.4/en-us/8-Fluid/9-using-php-based-views.html, but there is nothing different from what I have already done in my extension.

So, I am very confused because there is no explanation why the code stopped to work, the above link doesn’t include any instructions about deprecated code or possible changes after migration!!

Could you give me any help?

Thank you very much!
George

2

Answers


  1. Chosen as BEST ANSWER

    the static template is already included and all the other operations of the extension are working very well except the php based views. The ext_localconf.php looks as follows: <?php defined('TYPO3_MODE') || die('Access denied.');

    $boot = function () {

        TYPO3CMSExtbaseUtilityExtensionUtility::configurePlugin(
            'Luc.Lucevents2',
            'Luceventsdisplay',
            [
                'Event' => 'list, show, delete, edit, monthview, test, ajax, deleteConfirm, showRss, getIcal, addForm, add, editForm, importeventtoforum',
                'Channel' => 'list, show',
                'Tag' => 'filter, show'
            ],
            // non-cacheable actions
            [
                'Event' => 'list, show, delete, edit, monthview, test, ajax, deleteConfirm, showRss, getIcal, addForm, add, editForm, importeventtoforum',
                'Channel' => 'list, show',
                'Tag' => 'filter, show'
            ]
        );
            
    

    };

    $boot();

    unset($boot);

    The action is registered in EventController.php and looks as follows:

    /** * action geticalaction * * @param LucLucevents2DomainModelEvent $event * @return void */

     public function getIcalAction(LucLucevents2DomainModelEvent $event = NULL)
    {
        $base_url = $this->request->getBaseUri();
        $channel=$this->settings['channel_for_simple_users'];
        
    
        if($this->request->hasArgument('duration'))
        {           
            if ($this->request->getArgument('duration')=='6month') {
                $duration=$this->request->getArgument('duration');              
            }
            else 
            {
                $duration='month';
            }           
            
            $events = $this->eventRepository->get_events_for_rss_and_ical($duration,$channel);
            $eventsarray= array();
            
            foreach ($events as $obj){                              
                $this->uriBuilder->setCreateAbsoluteUri(true);  
                $uri = $this->controllerContext->getUriBuilder()
                ->setUseCacheHash(false)
                ->uriFor('show', array("event" => $obj->getUid()));
                
                $eventsarray[] = array($obj->getTitle(), $obj->getDescription(), $obj->getStartdatetime(),$obj->getEnddatetime(), $obj->getBuildingid(), $obj->getRoomid(), $obj->getPlace(), $obj->getCrdate(), $uri, $obj->getUid());
            }       
                            
            $this->view->assign('events', $eventsarray);
            $this->view->assign('baseurl', $base_url);
                    
        }
        else
        {       
            $this->uriBuilder->setCreateAbsoluteUri(true);
            $uri = $this->controllerContext->getUriBuilder()
            ->setUseCacheHash(false)
            ->uriFor('show', array("event" => $event->getUid()));
            
            $this->view->assign('event', $event);
            $this->view->assign('baseurl', $base_url);
            $this->view->assign('uri', $uri);
            
        }           
    }
    

    Thank you very much!


  2. I hit this problem today. The documentation for "php based views" seems to be outdated.Below is a description of my setup and the solution for TYPO3 10

    What I had:
    My situation was that I had a Controller with a showAction() action method.
    In typoscript, I had setup a new format through the type parameter. Something like

    rss = PAGE
    rss {
       typeNum = 58978
       10 =< tt_content.list.20.skevents_eventfeeds
    }
    

    For this type (parameter type=58978) I had setup a class named ViewEventFeedsShowRss with a render() method.

    TYPO3 automatically resolved this class based on the type (rss) and the action name (show). This does not work any more.

    What solves this issue:
    in order for TYPO3 to find the correct class with the render method, it is sufficient to set the defaultViewObjectName variable of the Controller to the correct class name for the specific action. This can be done in the controller with the following new method

    public function initializeShowAction() 
    {
       $this->defaultViewObjectName = SkarSkeventsViewEventFeedsShowRss::class;
    }
    

    So now, before calling the showAction method, defaultViewObjectName is set to my ShowRss class which produces the output.

    Please note that my ShowRss class extends TYPO3CMSExtbaseMvcViewAbstractView . According to https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/8-Fluid/9-using-php-based-views.html this is deprecated in TYPO3 11 and will have to change for TYPO3 12

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search