11<?php
2+
23/**
34 * Copyright since 2007 PrestaShop SA and Contributors
45 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
@@ -48,14 +49,17 @@ public function hookActionObjectEmployeeAddAfter($parameters)
4849 /** @var \Employee $employee * */
4950 $ employee = $ parameters ['object ' ];
5051
51- $ synchronizationService ->sendLiveSync (Config::COLLECTION_EMPLOYEES , Config::INCREMENTAL_TYPE_UPSERT );
52- $ synchronizationService ->insertContentIntoIncremental (
53- [Config::COLLECTION_EMPLOYEES => $ employee ->id ],
54- Config::INCREMENTAL_TYPE_UPSERT ,
55- date (DATE_ATOM ),
56- $ this ->shopId ,
57- false
58- );
52+ // Not nullable
53+ if ($ employee ->id ) {
54+ $ synchronizationService ->sendLiveSync (Config::COLLECTION_EMPLOYEES , Config::INCREMENTAL_TYPE_UPSERT );
55+ $ synchronizationService ->insertContentIntoIncremental (
56+ [Config::COLLECTION_EMPLOYEES => $ employee ->id ],
57+ Config::INCREMENTAL_TYPE_UPSERT ,
58+ date (DATE_ATOM ),
59+ $ this ->shopId ,
60+ false
61+ );
62+ }
5963 }
6064
6165 /**
@@ -71,14 +75,17 @@ public function hookActionObjectEmployeeUpdateAfter($parameters)
7175 /** @var \Employee $employee * */
7276 $ employee = $ parameters ['object ' ];
7377
74- $ synchronizationService ->sendLiveSync (Config::COLLECTION_EMPLOYEES , Config::INCREMENTAL_TYPE_UPSERT );
75- $ synchronizationService ->insertContentIntoIncremental (
76- [Config::COLLECTION_EMPLOYEES => $ employee ->id ],
77- Config::INCREMENTAL_TYPE_UPSERT ,
78- date (DATE_ATOM ),
79- $ this ->shopId ,
80- false
81- );
78+ // Not nullable
79+ if ($ employee ->id ) {
80+ $ synchronizationService ->sendLiveSync (Config::COLLECTION_EMPLOYEES , Config::INCREMENTAL_TYPE_UPSERT );
81+ $ synchronizationService ->insertContentIntoIncremental (
82+ [Config::COLLECTION_EMPLOYEES => $ employee ->id ],
83+ Config::INCREMENTAL_TYPE_UPSERT ,
84+ date (DATE_ATOM ),
85+ $ this ->shopId ,
86+ false
87+ );
88+ }
8289 }
8390
8491 /**
@@ -94,13 +101,16 @@ public function hookActionObjectEmployeeDeleteAfter($parameters)
94101 /** @var \Employee $employee * */
95102 $ employee = $ parameters ['object ' ];
96103
97- $ synchronizationService ->sendLiveSync (Config::COLLECTION_EMPLOYEES , Config::INCREMENTAL_TYPE_DELETE );
98- $ synchronizationService ->insertContentIntoIncremental (
99- [Config::COLLECTION_EMPLOYEES => $ employee ->id ],
100- Config::INCREMENTAL_TYPE_DELETE ,
101- date (DATE_ATOM ),
102- $ this ->shopId ,
103- false
104- );
104+ // Not nullable
105+ if ($ employee ->id ) {
106+ $ synchronizationService ->sendLiveSync (Config::COLLECTION_EMPLOYEES , Config::INCREMENTAL_TYPE_DELETE );
107+ $ synchronizationService ->insertContentIntoIncremental (
108+ [Config::COLLECTION_EMPLOYEES => $ employee ->id ],
109+ Config::INCREMENTAL_TYPE_DELETE ,
110+ date (DATE_ATOM ),
111+ $ this ->shopId ,
112+ false
113+ );
114+ }
105115 }
106116}
0 commit comments