fix: avoid null pointer exception
This commit is contained in:
@@ -95,9 +95,9 @@ class TravelXmlLoader extends AbstractXmlLoader
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = $mapping[$travelId]['file'];
|
$filename = $mapping[$travelId]['file'];
|
||||||
|
|
||||||
return $this->loadXml($travelId, $hotelId, $file);
|
return $this->loadXml($travelId, $hotelId, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadXml(int $id, ?int $hotelId, string $filename): ?Travel
|
private function loadXml(int $id, ?int $hotelId, string $filename): ?Travel
|
||||||
@@ -115,14 +115,13 @@ class TravelXmlLoader extends AbstractXmlLoader
|
|||||||
|
|
||||||
public function parseXml(\SimpleXMLElement $xml, ?int $hotelId): Travel
|
public function parseXml(\SimpleXMLElement $xml, ?int $hotelId): Travel
|
||||||
{
|
{
|
||||||
$hotelXml = $this->getHotelXml($xml, $hotelId);
|
|
||||||
|
|
||||||
$attributes = $xml->attributes();
|
$attributes = $xml->attributes();
|
||||||
|
$hotelXml = $this->getHotelXml($xml, $hotelId);
|
||||||
|
|
||||||
$travel = new Travel();
|
$travel = new Travel();
|
||||||
$travel->id = (int) $attributes['idbuspro'];
|
$travel->id = (int) $attributes['idbuspro'];
|
||||||
|
$travel->hotelId = $hotelId;
|
||||||
$travel->label = (string) $xml->text;
|
$travel->label = (string) $xml->text;
|
||||||
$travel->hotelId = (int) $hotelXml->attributes()['idbuspro'];
|
|
||||||
$travel->dateFrom = $this->stringToDate((string) $attributes['termin']);
|
$travel->dateFrom = $this->stringToDate((string) $attributes['termin']);
|
||||||
$travel->dateTo = $this->stringToDate((string) $attributes['bis']);
|
$travel->dateTo = $this->stringToDate((string) $attributes['bis']);
|
||||||
$travel->code = (string) $attributes['code'];
|
$travel->code = (string) $attributes['code'];
|
||||||
|
|||||||
Reference in New Issue
Block a user