Modify ticket link import

This commit is contained in:
Dirk Koritnik 2020-10-01 09:45:32 +02:00
parent 61cd617130
commit 5e272178a5

View file

@ -293,10 +293,14 @@ class DestinationDataImportService {
if($event['addresses']) if($event['addresses'])
$this->setOrganizer($event['addresses']); $this->setOrganizer($event['addresses']);
// Set Social and Tickets // Set Social
if($event['media_objects']) if($event['media_objects'])
$this->setSocial($event['media_objects']); $this->setSocial($event['media_objects']);
// Set Tickets
if($event['media_objects'])
$this->setTickets($event['media_objects']);
// Set Dates // Set Dates
if($event['timeIntervals']) if($event['timeIntervals'])
$this->setDates($event['timeIntervals']); $this->setDates($event['timeIntervals']);
@ -497,10 +501,45 @@ class DestinationDataImportService {
$this->tmpCurrentEvent->setYouTube($link['url']); $this->tmpCurrentEvent->setYouTube($link['url']);
if ($link['rel'] == "socialmedia" && $link['value'] == "Instagram") if ($link['rel'] == "socialmedia" && $link['value'] == "Instagram")
$this->tmpCurrentEvent->setInstagram($link['url']); $this->tmpCurrentEvent->setInstagram($link['url']);
if ($link['rel'] == "booking") }
}
/**
* @param array $media
*/
protected function seTickets(Array $media) {
foreach ($media as $link)
{
if ($link['rel'] == "ticket") {
$this->tmpCurrentEvent->setTicket($link['url']);
break;
} elseif ($link['rel'] == "booking" && !$this->multi_array_key_exists('ticket', $media)) {
$this->tmpCurrentEvent->setTicket($link['url']);
break;
} elseif ($link['rel'] == "PRICE_KARTENLINK" && !$this->multi_array_key_exists('ticket', $media) && !$this->multi_array_key_exists('booking', $media)) {
$this->tmpCurrentEvent->setTicket($link['url']); $this->tmpCurrentEvent->setTicket($link['url']);
} }
} }
}
/**
* @param string $needle
* @param array $haystack
*/
protected function multi_array_key_exists( $needle, $haystack ) {
foreach ( $haystack as $key => $value ) {
if ( $needle == $key ) {
return true;
}
if ( is_array( $value ) ) {
if ( $this->multi_array_key_exists( $needle, $value ) == true ) {
return true;
}
}
}
return false;
}
/** /**
* @param string $lat * @param string $lat