mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-26 02:56:12 +01:00

[CLEANUP] Use a dedicated inject method

This will improve performance.
This commit is contained in:
Oliver Klee 2017-12-09 17:41:35 +01:00
parent cb62d0c28b
commit a2b322d53c
2 changed files with 12 additions and 2 deletions

View file

@ -14,6 +14,7 @@ namespace OliverKlee\Tea\Controller;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/** /**
@ -24,11 +25,20 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class TestimonialController extends ActionController class TestimonialController extends ActionController
{ {
/** /**
* @inject
* @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository * @var \OliverKlee\Tea\Domain\Repository\TestimonialRepository
*/ */
protected $testimonialRepository = null; protected $testimonialRepository = null;
/**
* @param TestimonialRepository $repository
*
* @return void
*/
public function injectTestimonialRepository(TestimonialRepository $repository)
{
$this->testimonialRepository = $repository;
}
/** /**
* Lists all testimonials. * Lists all testimonials.
* *

View file

@ -70,7 +70,7 @@ class TestimonialControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
$this->testimonialRepositoryProphecy = $this->prophesize(TestimonialRepository::class); $this->testimonialRepositoryProphecy = $this->prophesize(TestimonialRepository::class);
$this->testimonialRepository = $this->testimonialRepositoryProphecy->reveal(); $this->testimonialRepository = $this->testimonialRepositoryProphecy->reveal();
$this->inject($this->subject, 'testimonialRepository', $this->testimonialRepository); $this->subject->injectTestimonialRepository($this->testimonialRepository);
} }
/** /**