Skip to content
Snippets Groups Projects
Unverified Commit af716936 authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Publish 2.4.4

Some small fixes after 2.4.3
parent e80c7dd3
No related branches found
Tags 2.4.4
No related merge requests found
parameters: parameters:
app.version: 2.4.3 app.version: 2.4.4
\ No newline at end of file \ No newline at end of file
...@@ -96,7 +96,9 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -96,7 +96,9 @@ class MigrationCommand extends GoGoAbstractCommand
if (count($this->messages) > $migrationState->getMessagesIndex()) { if (count($this->messages) > $migrationState->getMessagesIndex()) {
$messagesToAdd = array_slice($this->messages, $migrationState->getMessagesIndex()); $messagesToAdd = array_slice($this->messages, $migrationState->getMessagesIndex());
$this->log(count($messagesToAdd) . " messages to add");
foreach($dbs as $db) { foreach($dbs as $db) {
$this->log("add message on project " . $db);
foreach($messagesToAdd as $message) { foreach($messagesToAdd as $message) {
// create a GoGoLogUpdate // create a GoGoLogUpdate
$asyncService->callCommand('gogolog:add:message', ['"' . $message . '"'], $db); $asyncService->callCommand('gogolog:add:message', ['"' . $message . '"'], $db);
......
...@@ -51,16 +51,19 @@ class OpenHours ...@@ -51,16 +51,19 @@ class OpenHours
* @MongoDB\EmbedOne(targetDocument="Biopen\GeoDirectoryBundle\Document\DailyTimeSlot") */ * @MongoDB\EmbedOne(targetDocument="Biopen\GeoDirectoryBundle\Document\DailyTimeSlot") */
private $Sunday; private $Sunday;
public function __construct($openHours) public function __construct($openHours = null)
{ {
foreach ($openHours as $day => $timeSlotString) { if ($openHours && is_array($openHours))
$slot1start = null; $slot1end = null; $slot2start = null; $slot2end = null; {
$slots = explode(',', $timeSlotString); foreach ($openHours as $day => $timeSlotString) {
if (count($slots) > 0) list($slot1start, $slot1end) = $this->buildSlotsFrom($slots[0]); $slot1start = null; $slot1end = null; $slot2start = null; $slot2end = null;
if (count($slots) == 2) list($slot2start, $slot2end) = $this->buildSlotsFrom($slots[1]); $slots = explode(',', $timeSlotString);
$dailySlot = new DailyTimeSlot($slot1start, $slot1end, $slot2start, $slot2end); if (count($slots) > 0) list($slot1start, $slot1end) = $this->buildSlotsFrom($slots[0]);
$method = 'set' . $this->days[$day]; if (count($slots) == 2) list($slot2start, $slot2end) = $this->buildSlotsFrom($slots[1]);
$this->$method($dailySlot); $dailySlot = new DailyTimeSlot($slot1start, $slot1end, $slot2start, $slot2end);
$method = 'set' . $this->days[$day];
$this->$method($dailySlot);
}
} }
} }
......
...@@ -95,6 +95,8 @@ class ElementImportMappingService ...@@ -95,6 +95,8 @@ class ElementImportMappingService
// Ontology // Ontology
$this->collectOntology($data, $import); $this->collectOntology($data, $import);
$data = $this->mapOntology($data); $data = $this->mapOntology($data);
if (!is_array($data)) return [];
// remove empty row, i.e. without name // remove empty row, i.e. without name
$data = array_filter($data, function($row) { return array_key_exists('name', $row); }); $data = array_filter($data, function($row) { return array_key_exists('name', $row); });
......
...@@ -52,6 +52,13 @@ class ElementImportOneService ...@@ -52,6 +52,13 @@ class ElementImportOneService
{ {
$updateExisting = false; // if we create a new element or update an existing one $updateExisting = false; // if we create a new element or update an existing one
$realUpdate = false; // if we are sure that the external has been edited with 'FieldToCheckElementHaveBeenUpdated' $realUpdate = false; // if we are sure that the external has been edited with 'FieldToCheckElementHaveBeenUpdated'
// adds missings fields instead of checking if each field is set before accessing
$missingFields = array_diff($this->coreFields, array_keys($row));
foreach ($missingFields as $missingField) {
$row[$missingField] = "";
}
if (isset($row['id'])) if (isset($row['id']))
{ {
if (in_array($row['id'], $import->getIdsToIgnore())) return; if (in_array($row['id'], $import->getIdsToIgnore())) return;
...@@ -92,12 +99,6 @@ class ElementImportOneService ...@@ -92,12 +99,6 @@ class ElementImportOneService
} }
$this->currentRow = $row; $this->currentRow = $row;
// adds missings fields instead of checking if each field is set before accessing
$missingFields = array_diff($this->coreFields, array_keys($row));
foreach ($missingFields as $missingField) {
$row[$missingField] = "";
}
$element->setOldId($row['id']); $element->setOldId($row['id']);
$element->setName($row['name']); $element->setName($row['name']);
$address = new PostalAddress($row['streetAddress'], $row['addressLocality'], $row['postalCode'], $row["addressCountry"]); $address = new PostalAddress($row['streetAddress'], $row['addressLocality'], $row['postalCode'], $row["addressCountry"]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment