-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from EaDesgin/feature/Romcity-Fix-admin
Romcity: Fix admin select
- Loading branch information
Showing
4 changed files
with
107 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Eadesigndev\RomCity\Block\Checkout; | ||
|
||
use Magento\Backend\Block\Template; | ||
use Eadesigndev\RomCity\Model\RomCityRepository; | ||
use Eadesigndev\RomCity\Model\RomCity; | ||
use Magento\Framework\Api\SearchCriteriaBuilder; | ||
use Magento\Framework\Serialize\SerializerInterface; | ||
use Magento\Backend\Block\Template\Context; | ||
|
||
/** | ||
* Class CityUpdater | ||
* @package Eadesigndev\RomCity\Block\Checkout | ||
*/ | ||
class CityUpdater extends Template | ||
{ | ||
/** @var RomCityRepository */ | ||
private $romCityRepository; | ||
|
||
/** @var SearchCriteriaBuilder */ | ||
private $searchCriteria; | ||
|
||
/** @var SerializerInterface */ | ||
private $serializer; | ||
|
||
public function __construct( | ||
Context $context, | ||
RomCityRepository $romCityRepository, | ||
SearchCriteriaBuilder $searchCriteria, | ||
SerializerInterface $serializer, | ||
array $data = [] | ||
) | ||
{ | ||
$this->searchCriteria = $searchCriteria; | ||
$this->romCityRepository = $romCityRepository; | ||
$this->serializer = $serializer; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
public function citiesJson() | ||
{ | ||
|
||
$searchCriteriaBuilder = $this->searchCriteria; | ||
$searchCriteria = $searchCriteriaBuilder->create(); | ||
|
||
$citiesList = $this->romCityRepository->getList($searchCriteria); | ||
$items = $citiesList->getItems(); | ||
|
||
$return = []; | ||
|
||
/** @var RomCity $item */ | ||
foreach ($items as $item) { | ||
$return[] = ['region_id' => $item->getRegionId(), 'city_name' => $item->getCityName()]; | ||
} | ||
|
||
return $this->serializer->serialize($return); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters