Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Vendor\Extension\Controller;
- use SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository;
- class DataController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
- {
- /**
- * @var \TYPO3\CMS\Extbase\Mvc\View\JsonView
- */
- protected $view;
- /**
- * Use my own view instead default one
- * @var string
- */
- protected $defaultViewObjectName = \Vendor\Extension\View\JsonView::class;
- /**
- * @var \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository
- */
- protected $countryZoneRepository = null;
- /**
- * @param \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository
- * @return void
- */
- public function injectCountryZoneRepository(CountryZoneRepository $countryZoneRepository) {
- $this->countryZoneRepository = $countryZoneRepository;
- }
- /**
- * @param \SJBR\StaticInfoTables\Domain\Model\Country|null $country
- * @return void
- */
- public function getZonesByCountryAction(\SJBR\StaticInfoTables\Domain\Model\Country $country = null)
- {
- $zones = [];
- $this->view->setVariablesToRender(['zones']);
- if ($country instanceof \SJBR\StaticInfoTables\Domain\Model\Country) {
- $zones = $this->countryZoneRepository->findByCountry($country);
- }
- $this->view->assign('zones', $zones);
- }
- }
Add Comment
Please, Sign In to add comment