daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jul 20th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. namespace Vendor\Extension\Controller;
  3.  
  4. use SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository;
  5.  
  6. class DataController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
  7. {
  8.     /**
  9.      * @var \TYPO3\CMS\Extbase\Mvc\View\JsonView
  10.      */
  11.     protected $view;
  12.  
  13.     /**
  14.      * Use my own view instead default one
  15.      * @var string
  16.      */
  17.     protected $defaultViewObjectName = \Vendor\Extension\View\JsonView::class;
  18.  
  19.     /**
  20.      * @var \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository
  21.      */
  22.     protected $countryZoneRepository = null;
  23.  
  24.     /**
  25.      * @param \SJBR\StaticInfoTables\Domain\Repository\CountryZoneRepository $countryZoneRepository
  26.      * @return void
  27.      */
  28.     public function injectCountryZoneRepository(CountryZoneRepository $countryZoneRepository) {
  29.         $this->countryZoneRepository = $countryZoneRepository;
  30.     }
  31.  
  32.     /**
  33.      * @param \SJBR\StaticInfoTables\Domain\Model\Country|null $country
  34.      * @return void
  35.      */
  36.     public function getZonesByCountryAction(\SJBR\StaticInfoTables\Domain\Model\Country $country = null)
  37.     {
  38.         $zones = [];
  39.         $this->view->setVariablesToRender(['zones']);
  40.         if ($country instanceof \SJBR\StaticInfoTables\Domain\Model\Country) {
  41.             $zones = $this->countryZoneRepository->findByCountry($country);
  42.         }
  43.         $this->view->assign('zones', $zones);
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top