0

i wrote a signalslot extension for tx_news which extends the detailAction. The dispatcher works as expected when a news in detail view is called. But when the detail page is called without valid parameters for a existing news entry i get the following error:

Oops, an error occurred!
Argument 1 passed to .....\Slots\NewsControllerSlot::detailActionSlot() must be an instance of GeorgRinger\News\Domain\Model\News, null given

The error is easy to understand:

public function detailActionSlot(News $newsItem, $currentPage, $demand, $settings, $extendedVariables)

the first parameter $newsItem is missing.

But how can i avoid the error? Thanks!

lisardo
  • 1,322
  • 16
  • 31

2 Answers2

1

Create a pr on github or at least an issue, this is a bug

Georg Ringer
  • 7,779
  • 1
  • 16
  • 34
0

David Bruchmann gave me a hint:

public function detailActionSlot(News $newsItem = null, $currentPage, $demand, $settings, $extendedVariables)
{
    if (is_object($newsItem)) { 
        // do stuff here
   }
}

works perfectly even the 404 is thrown.

lisardo
  • 1,322
  • 16
  • 31