bookmark-pages/Classes/Controller/AbstractController.php
2021-08-20 13:33:13 +02:00

42 lines
1.2 KiB
PHP

<?php
namespace WapplerSystems\BookmarksLikesRatings\Controller;
use TYPO3\CMS\Frontend\Exception;
use WapplerSystems\BookmarksLikesRatings\Domain\Repository\BookmarkRepository;
use WapplerSystems\BookmarksLikesRatings\Domain\Repository\LikeRepository;
class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/** @var BookmarkRepository */
protected $bookmarkRepository;
/**
* @param \WapplerSystems\BookmarksLikesRatings\Domain\Repository\BookmarkRepository $bookmarkRepository
*/
public function injectBookmarkRepository(BookmarkRepository $bookmarkRepository) {
$this->bookmarkRepository = $bookmarkRepository;
}
/** @var LikeRepository */
protected $likeRepository;
/**
* @param \WapplerSystems\BookmarksLikesRatings\Domain\Repository\LikeRepository $bookmarkRepository
*/
public function injectLikeRepository(LikeRepository $likeRepository) {
$this->likeRepository = $likeRepository;
}
protected function getCurrentUser() : array {
if (!$GLOBALS['TSFE']->fe_user) {
throw new Exception('no access');
}
return $GLOBALS['TSFE']->fe_user->user;
}
}