I updated my Typo3 installation from version 11 to 12. I have an extension that extends the New System and I created an Author model
class News extends \GeorgRinger\News\Domain\Model\NewsDefault
Later, I get the UID from this model in the demand.
class NewsDemand extends \GeorgRinger\News\Domain\Model\Dto\NewsDemand
{
/**
* @var \BB\BbExtendNews\Domain\Model\Authors
*/
protected $newsAuthor;
/**
* Set news author
*
* @param \BB\BbExtendNews\Domain\Model\Authors $newsAuthor
* @return NewsDemand
*/
public function setNewsAuthor($newsAuthor)
{
$this->newsAuthor = $newsAuthor;
return $this;
}
/**
* Get news author
*
* @return \BB\BbExtendNews\Domain\Model\Authors
*/
public function getNewsAuthor()
{
return $this->newsAuthor;
}
}
In debug mode, the variable exists, but the value is not being passed. How can I access/get this value in demand?
Extbase Variable Dump
GeorgRinger\News\Domain\Model\Dto\NewsDemandprototypetransient entity
test => protected'' (0 chars)
categories => protectedarray(5 items)
categoryConjunction => protected'or' (2 chars)
includeSubCategories => protectedFALSE
author => protected'' (0 chars)
tags => protected'' (0 chars)
archiveRestriction => protected'' (0 chars)
timeRestriction => protected'' (0 chars)
timeRestrictionHigh => protected'' (0 chars)
topNewsRestriction => protected0 (integer)
dateField => protected'datetime' (8 chars)
month => protected0 (integer)
year => protected0 (integer)
day => protected0 (integer)
searchFields => protected'' (0 chars)
search => protectedNULL
order => protected'datetime desc' (13 chars)
orderByAllowed => protected'sorting,author,uid,title,teaser,author,tstamp,crdate,datetime,categories.tit
le' (78 chars)
topNewsFirst => protectedFALSE
storagePage => protected'1358' (4 chars)
limit => protected0 (integer)
offset => protected0 (integer)
excludeAlreadyDisplayedNews => protectedFALSE
hideIdList => protected'' (0 chars)
idList => protected'' (0 chars)
action => protected'BB\BbExtendNews\Controller\NewsController::listAuthorAction' (59 chars)
class => protected'BB\BbExtendNews\Controller\NewsController' (41 chars)
types => protectedarray(empty)
_customSettings => protectedarray(empty)
newsAuthor => protectedNULL
uid => protectedNULL
_localizedUid => protectedNULL
_languageUid => protectedNULL
_versionedUid => protectedNULL
pid => protectedNULL
NewsController.php
class NewsController extends \GeorgRinger\News\Controller\NewsController {
public function listAuthorAction(?array $overwriteDemand = null): ResponseInterface
{
$demand = $this->createDemandObjectFromSettings($this->settings);
$demand->setActionAndClass(__METHOD__, self::class);
if ((int)($this->settings['disableOverrideDemand'] ?? 1) !== 1 && $overwriteDemand !== null) {
$demand = $this->overwriteDemandObject($demand, $overwriteDemand);
}
/* It doesn't work */ if ($this->request->hasArgument('newsAuthor')) {
$newsAuthor = (int)$this->request->getArgument('newsAuthor');
$demand->setNewsAuthor($newsAuthor);
}
NewsRepository.php
if ($demand->getNewsAuthor()) {
$constraints['newsAuthor'] = $query->equals('newsAuthor', $demand->getNewsAuthor());
}
With TYPO3 version 11 it all works I also created a simple variable (not an object), but that is not received in demand either. How can I access/get these values in demand? Any example or guidance on how to properly extend or modify Demand would be greatly appreciated.