Как правильно передать пользовательские переменные для требования в расширении новостной системы Sypo3 12?Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Как правильно передать пользовательские переменные для требования в расширении новостной системы Sypo3 12?

Сообщение Anonymous »

Я обновил свою установку типо3 с версии 11 по 12. У меня есть расширение, которое расширяет новую систему, и я создал модель автора
class News extends \GeorgRinger\News\Domain\Model\NewsDefault< /code>
позже я получаю UID из этой модели в спросе. < /p>
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;
}
}
< /code>
В режиме отладки переменная существует, но значение не передается. Как я могу получить доступ/получить это значение в спросе?

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

< /code>
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);
}
< /code>
newsrepository.php
if ($demand->getNewsAuthor()) {
$constraints['newsAuthor'] = $query->equals('newsAuthor', $demand->getNewsAuthor());
}
< /code>
С помощью типов 3 версии 11 все работает
Я также создал простую переменную (не объект), но это также не получено в спросе. Как я могу получить доступ/получить эти значения в спросе? Любой пример или руководство о том, как правильно расширить или изменять спрос, будет очень оценен.

Подробнее здесь: https://stackoverflow.com/questions/797 ... m-extensio
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»