Avoid redundant database records
This commit is contained in:
@@ -298,11 +298,18 @@ class DateImportService implements SingletonInterface
|
||||
*/
|
||||
protected function parseDaytripDates(\SimpleXMLElement $xmlDate, array $product)
|
||||
{
|
||||
static $datesAdded = [];
|
||||
|
||||
foreach ($xmlDate->hotel as $xmlHotel)
|
||||
{
|
||||
$hotelCode = (string) $xmlHotel->attributes()['code'];
|
||||
$hotel = $this->hotelMappings[$hotelCode];
|
||||
$dateStart = \DateTime::createFromFormat('d.m.Y', (string) $xmlDate->attributes()['termin'])->format('Y-m-d');
|
||||
$key = $hotelCode . $dateStart;
|
||||
if (\in_array($key, $datesAdded, true)) {
|
||||
continue;
|
||||
}
|
||||
$datesAdded[] = $key;
|
||||
$hotel = $this->hotelMappings[$hotelCode];
|
||||
$this->db->insert(
|
||||
'tx_epproducts_domain_model_daytrip_temp',
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user