mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2025-03-15 08:43:50 +01:00
parent
e47753ecab
commit
fc16c2ccde
4 changed files with 15 additions and 33 deletions
|
@ -17,15 +17,10 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||||
*/
|
*/
|
||||||
class FrontEndEditorController extends ActionController
|
class FrontEndEditorController extends ActionController
|
||||||
{
|
{
|
||||||
private Context $context;
|
public function __construct(
|
||||||
|
private readonly Context $context,
|
||||||
private TeaRepository $teaRepository;
|
private readonly TeaRepository $teaRepository,
|
||||||
|
) {}
|
||||||
public function __construct(Context $context, TeaRepository $teaRepository)
|
|
||||||
{
|
|
||||||
$this->context = $context;
|
|
||||||
$this->teaRepository = $teaRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function indexAction(): ResponseInterface
|
public function indexAction(): ResponseInterface
|
||||||
{
|
{
|
||||||
|
@ -48,9 +43,7 @@ class FrontEndEditorController extends ActionController
|
||||||
return $userUid;
|
return $userUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Extbase\IgnoreValidation(['argumentName' => 'tea'])]
|
||||||
* @Extbase\IgnoreValidation("tea")
|
|
||||||
*/
|
|
||||||
public function editAction(Tea $tea): ResponseInterface
|
public function editAction(Tea $tea): ResponseInterface
|
||||||
{
|
{
|
||||||
$this->checkIfUserIsOwner($tea);
|
$this->checkIfUserIsOwner($tea);
|
||||||
|
@ -79,9 +72,7 @@ class FrontEndEditorController extends ActionController
|
||||||
return $this->redirect('index');
|
return $this->redirect('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Extbase\IgnoreValidation(['argumentName' => 'tea'])]
|
||||||
* @Extbase\IgnoreValidation("tea")
|
|
||||||
*/
|
|
||||||
public function newAction(?Tea $tea = null): ResponseInterface
|
public function newAction(?Tea $tea = null): ResponseInterface
|
||||||
{
|
{
|
||||||
// Note: We are using `makeInstance` here instead of `new` to allow for XCLASSing.
|
// Note: We are using `makeInstance` here instead of `new` to allow for XCLASSing.
|
||||||
|
@ -100,9 +91,7 @@ class FrontEndEditorController extends ActionController
|
||||||
return $this->redirect('index');
|
return $this->redirect('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Extbase\IgnoreValidation(['argumentName' => 'tea'])]
|
||||||
* @Extbase\IgnoreValidation("tea")
|
|
||||||
*/
|
|
||||||
public function deleteAction(Tea $tea): ResponseInterface
|
public function deleteAction(Tea $tea): ResponseInterface
|
||||||
{
|
{
|
||||||
$this->checkIfUserIsOwner($tea);
|
$this->checkIfUserIsOwner($tea);
|
||||||
|
|
|
@ -14,12 +14,9 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||||
*/
|
*/
|
||||||
class TeaController extends ActionController
|
class TeaController extends ActionController
|
||||||
{
|
{
|
||||||
private TeaRepository $teaRepository;
|
public function __construct(
|
||||||
|
private readonly TeaRepository $teaRepository,
|
||||||
public function __construct(TeaRepository $teaRepository)
|
) {}
|
||||||
{
|
|
||||||
$this->teaRepository = $teaRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function indexAction(): ResponseInterface
|
public function indexAction(): ResponseInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,22 +14,18 @@ use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
|
||||||
*/
|
*/
|
||||||
class Tea extends AbstractEntity
|
class Tea extends AbstractEntity
|
||||||
{
|
{
|
||||||
/**
|
#[Extbase\Validate(['validator' => 'StringLength', 'options' => ['maximum' => 255]])]
|
||||||
* @Extbase\Validate("StringLength", options={"maximum": 255})
|
#[Extbase\Validate(['validator' => 'NotEmpty'])]
|
||||||
* @Extbase\Validate("NotEmpty")
|
|
||||||
*/
|
|
||||||
protected string $title = '';
|
protected string $title = '';
|
||||||
|
|
||||||
/**
|
#[Extbase\Validate(['validator' => 'StringLength', 'options' => ['maximum' => 2000]])]
|
||||||
* @Extbase\Validate("StringLength", options={"maximum": 2000})
|
|
||||||
*/
|
|
||||||
protected string $description = '';
|
protected string $description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var FileReference|null
|
* @var FileReference|null
|
||||||
* @phpstan-var FileReference|LazyLoadingProxy|null
|
* @phpstan-var FileReference|LazyLoadingProxy|null
|
||||||
* @Extbase\ORM\Lazy
|
|
||||||
*/
|
*/
|
||||||
|
#[Extbase\ORM\Lazy]
|
||||||
protected $image;
|
protected $image;
|
||||||
|
|
||||||
// Note: We cannot use `@var` for the more specific type annotation here as this confuses the Extbase type mapper.
|
// Note: We cannot use `@var` for the more specific type annotation here as this confuses the Extbase type mapper.
|
||||||
|
|
|
@ -26,7 +26,7 @@ return RectorConfig::configure()
|
||||||
__DIR__ . '/ext_emconf.php',
|
__DIR__ . '/ext_emconf.php',
|
||||||
__DIR__ . '/ext_localconf.php',
|
__DIR__ . '/ext_localconf.php',
|
||||||
])
|
])
|
||||||
->withPhpVersion(PhpVersion::PHP_74)
|
->withPhpVersion(PhpVersion::PHP_81)
|
||||||
->withPhpSets(
|
->withPhpSets(
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue