Skip to content

Commit

Permalink
fix: incremental for employees
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Dec 6, 2024
1 parent dd682ff commit cb3fbad
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Traits/Hooks/UseEmployeeHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ trait UseEmployeeHooks
/**
* @return void
*/
public function hookActionObjectEmployeeAddAfter()
public function hookActionObjectEmployeeAddAfter($parameters)
{
/** @var SynchronizationService $synchronizationService * */
$synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME);

/** @var \Employee $employee **/
$employee = $parameters['object'];

$synchronizationService->sendLiveSync(Config::COLLECTION_EMPLOYEES, Config::INCREMENTAL_TYPE_UPSERT);
$synchronizationService->insertContentIntoIncremental(
[Config::COLLECTION_EMPLOYEES => 0],
[Config::COLLECTION_EMPLOYEES => $employee->id],
Config::INCREMENTAL_TYPE_UPSERT,
date(DATE_ATOM),
$this->shopId,
Expand All @@ -56,14 +59,17 @@ public function hookActionObjectEmployeeAddAfter()
/**
* @return void
*/
public function hookActionObjectEmployeeUpdateAfter()
public function hookActionObjectEmployeeUpdateAfter($parameters)
{
/** @var SynchronizationService $synchronizationService * */
$synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME);

/** @var \Employee $employee **/
$employee = $parameters['object'];

$synchronizationService->sendLiveSync(Config::COLLECTION_EMPLOYEES, Config::INCREMENTAL_TYPE_UPSERT);
$synchronizationService->insertContentIntoIncremental(
[Config::COLLECTION_EMPLOYEES => 0],
[Config::COLLECTION_EMPLOYEES => $employee->id],
Config::INCREMENTAL_TYPE_UPSERT,
date(DATE_ATOM),
$this->shopId,
Expand All @@ -74,14 +80,17 @@ public function hookActionObjectEmployeeUpdateAfter()
/**
* @return void
*/
public function hookActionObjectEmployeeDeleteAfter()
public function hookActionObjectEmployeeDeleteAfter($parameters)
{
/** @var SynchronizationService $synchronizationService * */
$synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME);

/** @var \Employee $employee **/
$employee = $parameters['object'];

$synchronizationService->sendLiveSync(Config::COLLECTION_EMPLOYEES, Config::INCREMENTAL_TYPE_DELETE);
$synchronizationService->insertContentIntoIncremental(
[Config::COLLECTION_EMPLOYEES => 0],
[Config::COLLECTION_EMPLOYEES => $employee->id],
Config::INCREMENTAL_TYPE_DELETE,
date(DATE_ATOM),
$this->shopId,
Expand Down

0 comments on commit cb3fbad

Please sign in to comment.