-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,005 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use PrestaShop\Module\PsEventbus\Config\Config; | ||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController; | ||
use PrestaShop\Module\PsEventbus\Provider\ManufacturerDataProvider; | ||
|
||
class ps_EventbusApiManufacturersModuleFrontController extends AbstractApiController | ||
{ | ||
public $type = Config::COLLECTION_MANUFACTURERS; | ||
|
||
/** | ||
* @return void | ||
* | ||
* @throws PrestaShopException | ||
*/ | ||
public function postProcess() | ||
{ | ||
/** @var ManufacturerDataProvider $manufacturerDataProvider */ | ||
$manufacturerDataProvider = $this->module->getService(ManufacturerDataProvider::class); | ||
|
||
$response = $this->handleDataSync($manufacturerDataProvider); | ||
|
||
$this->exitWithResponse($response); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
use PrestaShop\Module\PsEventbus\Config\Config; | ||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController; | ||
use PrestaShop\Module\PsEventbus\Provider\SupplierDataProvider; | ||
|
||
class ps_EventbusApiSuppliersModuleFrontController extends AbstractApiController | ||
{ | ||
public $type = Config::COLLECTION_SUPPLIERS; | ||
|
||
/** | ||
* @return void | ||
* | ||
* @throws PrestaShopException | ||
*/ | ||
public function postProcess() | ||
{ | ||
/** @var SupplierDataProvider $supplierDataProvider */ | ||
$supplierDataProvider = $this->module->getService(SupplierDataProvider::class); | ||
|
||
$response = $this->handleDataSync($supplierDataProvider); | ||
|
||
$this->exitWithResponse($response); | ||
} | ||
} |
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
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,46 @@ | ||
<?php | ||
|
||
namespace PrestaShop\Module\PsEventbus\Decorator; | ||
|
||
use PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository; | ||
|
||
class ManufacturerDecorator | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $timezone; | ||
|
||
public function __construct( | ||
ConfigurationRepository $configurationRepository | ||
) { | ||
$this->timezone = (string) $configurationRepository->get('PS_TIMEZONE'); | ||
} | ||
|
||
/** | ||
* @param array $manufacturers | ||
* | ||
* @return void | ||
*/ | ||
public function decorateManufacturers(array &$manufacturers) | ||
{ | ||
foreach ($manufacturers as &$manufacturer) { | ||
$this->castPropertyValues($manufacturer); | ||
} | ||
} | ||
|
||
/** | ||
* @param array $manufacturer | ||
* | ||
* @return void | ||
*/ | ||
private function castPropertyValues(array &$manufacturer) | ||
{ | ||
$manufacturer['id_manufacturer'] = (int) $manufacturer['id_manufacturer']; | ||
$manufacturer['active'] = (bool) $manufacturer['active']; | ||
$manufacturer['id_lang'] = (int) $manufacturer['id_lang']; | ||
$manufacturer['id_shop'] = (int) $manufacturer['id_shop']; | ||
$manufacturer['created_at'] = (new \DateTime($manufacturer['created_at'], new \DateTimeZone($this->timezone)))->format('Y-m-d\TH:i:sO'); | ||
$manufacturer['updated_at'] = (new \DateTime($manufacturer['updated_at'], new \DateTimeZone($this->timezone)))->format('Y-m-d\TH:i:sO'); | ||
} | ||
} |
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
Oops, something went wrong.