Remove slugs from locations

This commit is contained in:
Daniel Siepmann 2022-08-03 09:24:01 +00:00
parent 5652ea6442
commit 239bfe51fc
8 changed files with 585 additions and 47 deletions

View file

@ -56,11 +56,6 @@ class Location extends AbstractEntity
*/ */
protected $globalId = ''; protected $globalId = '';
/**
* @var string
*/
protected $slug = '';
public function __construct( public function __construct(
string $name, string $name,
string $street, string $street,
@ -71,7 +66,6 @@ class Location extends AbstractEntity
string $phone, string $phone,
string $latitude, string $latitude,
string $longitude, string $longitude,
string $slug,
int $languageUid int $languageUid
) { ) {
$this->name = $name; $this->name = $name;
@ -83,7 +77,6 @@ class Location extends AbstractEntity
$this->phone = $phone; $this->phone = $phone;
$this->latitude = $latitude; $this->latitude = $latitude;
$this->longitude = $longitude; $this->longitude = $longitude;
$this->slug = $slug;
$this->_languageUid = $languageUid; $this->_languageUid = $languageUid;
$this->globalId = $this->generateGlobalId(); $this->globalId = $this->generateGlobalId();

View file

@ -2,7 +2,6 @@
namespace Wrm\Events\Service\DestinationDataImportService; namespace Wrm\Events\Service\DestinationDataImportService;
use TYPO3\CMS\Core\DataHandling\SlugHelper;
use Wrm\Events\Domain\Model\Location; use Wrm\Events\Domain\Model\Location;
use Wrm\Events\Domain\Repository\LocationRepository; use Wrm\Events\Domain\Repository\LocationRepository;
@ -31,7 +30,6 @@ class LocationAssignment
$event['phone'] ?? '', $event['phone'] ?? '',
$event['geo']['main']['latitude'] ?? '', $event['geo']['main']['latitude'] ?? '',
$event['geo']['main']['longitude'] ?? '', $event['geo']['main']['longitude'] ?? '',
$this->createSlug($event['name'] ?? ''),
-1 -1
); );
@ -43,15 +41,4 @@ class LocationAssignment
return $existingLocation ?? $newLocation; return $existingLocation ?? $newLocation;
} }
public function createSlug(string $name): string
{
$slugHelper = new SlugHelper(
'tx_events_domain_model_location',
'slug',
$GLOBALS['TCA']['tx_events_domain_model_location']['columns']['slug']['config']
);
return $slugHelper->sanitize($name);
}
} }

View file

@ -31,7 +31,6 @@ return [
l10n_diffsource, l10n_diffsource,
hidden, hidden,
name, name,
slug,
global_id, global_id,
street, street,
@ -147,22 +146,6 @@ return [
'eval' => 'trim' 'eval' => 'trim'
], ],
], ],
'slug' => [
'exclude' => true,
'label' => $l10nPath . ':tx_events_domain_model_location.slug',
'config' => [
'type' => 'slug',
'size' => 50,
'generatorOptions' => [
'fields' => ['name'],
'fieldSeparator' => '/',
'prefixParentPageSlug' => false,
],
'fallbackCharacter' => '-',
'eval' => 'uniqueInSite',
'default' => '',
],
],
'name' => [ 'name' => [
'exclude' => true, 'exclude' => true,
'label' => $l10nPath . ':tx_events_domain_model_location.name', 'label' => $l10nPath . ':tx_events_domain_model_location.name',

View file

@ -0,0 +1,4 @@
"tx_events_domain_model_location",,,,,,,,,,,,,,,,,,,,
,"uid","pid","cruser_id","hidden","starttime","endtime","sys_language_uid","l10n_parent","t3ver_oid","t3ver_wsid","t3ver_state","name","street","district","city","zip","country","latitude","longitude","phone"
,"1","2","0","0","0","0",-1,0,"0","0","0","Schillerhaus Rudolstadt","Schillerstraße 25",,"Rudolstadt","07407","Deutschland","50.720971023259","11.335229873657","+ 49 3672 / 486470"
,"2","2","0","0","0","0",-1,0,"0","0","0","Schillerhaus Rudolstadt","Other address",,"Rudolstadt","07407","Deutschland","50.720971023259","11.335229873657","+ 49 3672 / 486470"
1 tx_events_domain_model_location
2 uid pid cruser_id hidden starttime endtime sys_language_uid l10n_parent t3ver_oid t3ver_wsid t3ver_state name street district city zip country latitude longitude phone
3 1 2 0 0 0 0 -1 0 0 0 0 Schillerhaus Rudolstadt Schillerstraße 25 Rudolstadt 07407 Deutschland 50.720971023259 11.335229873657 + 49 3672 / 486470
4 2 2 0 0 0 0 -1 0 0 0 0 Schillerhaus Rudolstadt Other address Rudolstadt 07407 Deutschland 50.720971023259 11.335229873657 + 49 3672 / 486470

View file

@ -0,0 +1,532 @@
{
"status": "OK",
"count": 3,
"overallcount": 50,
"channels": [],
"facetGroups": [],
"items": [
{
"global_id": "e_100347853",
"id": "100347853",
"title": "Allerlei Weihnachtliches (Heute mit Johannes Geißer)",
"type": "Event",
"categories": [
"Weihnachten"
],
"texts": [
{
"rel": "details",
"type": "text/html",
"value": "Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.<br>Eintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)<br>Um Voranmeldung unter 03672-486470 oder&nbsp;<a data-cke-saved-href=\"mailto:schillerhaus@rudolstadt.de\" href=\"mailto:schillerhaus@rudolstadt.de\">schillerhaus@rudolstadt.de</a>&nbsp;wird gebeten. <br><strong>Es gilt die 2G-PLUS-Regel.</strong>&nbsp;<br>"
},
{
"rel": "details",
"type": "text/plain",
"value": "Die Lichter sind entzündet, die Plätzchen duften, man rückt endlich wieder näher zusammen und lauscht den Geschichten. Vier Schauspieler*innen unseres Theaters überraschen mit ihren weihnachtlichen Texten, die sie für uns ausgewählt haben. Dazu plaudern sie über persönliche Anekdoten und erinnern sich an ihre schönsten und verrücktesten Weihnachtsfeste. Und da der Genuss in der Vorweihnachtszeit nicht fehlen darf, wird an jedem Adventssonntag eine andere weihnachtliche Spezialität serviert.\nEintritt: 10 € (inkl. Gedeck mit weihnachtlicher Schillerlocke)\nUm Voranmeldung unter 03672-486470 oder schillerhaus@rudolstadt.de wird gebeten.\nEs gilt die 2G-PLUS-Regel."
},
{
"rel": "teaser",
"type": "text/html"
},
{
"rel": "teaser",
"type": "text/plain"
}
],
"areas": [
"Rudolstadt und Umgebung"
],
"name": "Schillerhaus Rudolstadt",
"street": "Schillerstraße 25",
"zip": "07407",
"city": "Rudolstadt",
"district": "",
"country": "Deutschland",
"phone": "+ 49 3672 / 486470",
"geo": {
"main": {
"latitude": 50.720971023258805,
"longitude": 11.335229873657227
},
"entry": [],
"attributes": []
},
"fax": "+ 49 3672 / 486475",
"web": "http://www.schillerhaus.rudolstadt.de/",
"email": "schillerhaus@rudolstadt.de",
"author": "support@hubermedia.de",
"ratings": [
{
"type": "eT4",
"value": 40.0
},
{
"type": "order",
"value": 99.0001
}
],
"cuisine_types": [],
"payment": [],
"media_objects": [
{
"rel": "venuewebsite",
"url": "http://schillerhaus.rudolstadt.de/",
"latitude": null,
"longitude": null,
"value": ""
}
],
"keywords": [],
"timeIntervals": [
{
"weekdays": [],
"start": "2099-12-19T15:00:00+01:00",
"end": "2099-12-19T16:30:00+01:00",
"tz": "Europe/Berlin",
"interval": 1
}
],
"kitchenTimeIntervals": [],
"deliveryTimeIntervals": [],
"numbers": [],
"attributes": [
{
"key": "VO_Id",
"value": "100050775"
},
{
"key": "VO_CategoryName",
"value": "POI"
},
{
"key": "VA_Id",
"value": "100050775"
},
{
"key": "VA_CategoryName",
"value": "POI"
},
{
"key": "interval_first_match_start",
"value": "2099-12-19T15:00:00+01"
},
{
"key": "interval_first_match_end",
"value": "2099-12-19T16:30:00+01"
},
{
"key": "interval_match_count",
"value": "1"
}
],
"features": [
"vorhandenes Feature",
"Barrierefrei",
"Zielgruppe Jugendliche",
"Karten an der Abendkasse",
"Ausreichende Lüftung",
"Beachtung der Hygienehinweise"
],
"addresses": [
{
"name": "Städtetourismus in Thüringen e.V.",
"city": "Weimar",
"zip": "99423",
"street": "UNESCO-Platz 1",
"phone": "+49 (3643) 745 314",
"web": "http://www.thueringer-staedte.de",
"email": "verein@thueringer-staedte.de",
"rel": "author"
},
{
"name": "Städtetourismus in Thüringen\" e.V.",
"web": "http://www.thueringer-staedte.de",
"email": "verein@thueringer-staedte.de",
"rel": "organisation"
},
{
"name": "Schillerhaus Rudolstadt",
"city": "Rudolstadt",
"zip": "07407",
"street": "Schillerstraße 25",
"phone": "+ 49 3672 / 486470",
"fax": "+ 49 3672 / 486475",
"web": "http://schillerhaus.rudolstadt.de",
"email": "schillerhaus@rudolstadt.de",
"rel": "organizer"
}
],
"created": "2099-10-31T12:29:00+00:00",
"changed": "2099-12-14T08:29:00+00:00",
"source": {
"url": "http://destination.one/",
"value": "destination.one"
},
"company": "",
"postoffice": "",
"phone2": "",
"seasons": [],
"subitems": [],
"hyperObjects": []
},
{
"global_id": "e_100354481",
"id": "100354481",
"title": "Tüftlerzeit",
"type": "Event",
"categories": [
"Kinder"
],
"texts": [
{
"rel": "details",
"type": "text/html",
"value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.<br>Voranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420<br><br>Bitte beachten Sie die derzeit geltenden Zugangsregeln."
},
{
"rel": "details",
"type": "text/plain",
"value": "Die Tüftlerzeit wird dieses Mal ein weihnachtliches Angebot bereithalten. Alle kleinen Tüftler dürfen gespannt sein.\nVoranmeldung über: kinderbibliothek@rudolstadt.de oder 03672-486420\n\nBitte beachten Sie die derzeit geltenden Zugangsregeln."
},
{
"rel": "teaser",
"type": "text/html"
},
{
"rel": "teaser",
"type": "text/plain"
}
],
"areas": [
"Rudolstadt und Umgebung"
],
"name": "Schillerhaus Rudolstadt",
"street": "Schillerstraße 25",
"zip": "07407",
"city": "Rudolstadt",
"district": "",
"country": "Deutschland",
"phone": "+ 49 3672 / 486470",
"geo": {
"main": {
"latitude": 50.720971023258805,
"longitude": 11.335229873657227
},
"entry": [],
"attributes": []
},
"fax": "0 36 72 - 48 64 30",
"web": "http://www.stadtbibliothek-rudolstadt.de/",
"email": "stadtbibliothek@rudolstadt.de",
"author": "support@hubermedia.de",
"ratings": [
{
"type": "eT4",
"value": 40.0
},
{
"type": "order",
"value": 99.0001
}
],
"cuisine_types": [],
"payment": [],
"media_objects": [
{
"rel": "venuewebsite",
"url": "http://www.stadtbibliothek-rudolstadt.de/",
"latitude": null,
"longitude": null,
"value": ""
}
],
"keywords": [],
"timeIntervals": [
{
"weekdays": [],
"start": "2099-12-16T15:00:00+01:00",
"end": "2099-12-16T16:30:00+01:00",
"tz": "Europe/Berlin",
"interval": 1
},
{
"weekdays": [],
"start": "2099-04-01T11:00:00+02:00",
"end": "2099-04-01T13:00:00+02:00",
"repeatUntil": "2099-04-03T00:00+02:00",
"tz": "Europe/Berlin",
"freq": "Daily",
"interval": 1
},
{
"weekdays": [],
"start": "2099-02-17T15:00:00+01:00",
"end": "2099-02-17T17:00:00+01:00",
"tz": "Europe/Berlin",
"interval": 1
}
],
"kitchenTimeIntervals": [],
"deliveryTimeIntervals": [],
"numbers": [],
"attributes": [
{
"key": "VO_Id",
"value": "100042570"
},
{
"key": "VO_CategoryName",
"value": "POI"
},
{
"key": "VA_Id",
"value": "100042570"
},
{
"key": "VA_CategoryName",
"value": "POI"
},
{
"key": "interval_first_match_start",
"value": "2099-12-16T15:00:00+01"
},
{
"key": "interval_first_match_end",
"value": "2099-12-16T16:30:00+01"
},
{
"key": "interval_match_count",
"value": "3"
},
{
"key": "interval_last_match_start",
"value": "2022-02-17T15:00:00+01"
},
{
"key": "interval_last_match_end",
"value": "2022-02-17T17:00:00+01"
}
],
"features": [],
"addresses": [
{
"name": "Städtetourismus in Thüringen e.V.",
"city": "Weimar",
"zip": "99423",
"street": "UNESCO-Platz 1",
"phone": "+49 (3643) 745 314",
"web": "http://www.thueringer-staedte.de",
"email": "verein@thueringer-staedte.de",
"rel": "author"
},
{
"name": "Städtetourismus in Thüringen\" e.V.",
"web": "http://www.thueringer-staedte.de",
"email": "verein@thueringer-staedte.de",
"rel": "organisation"
},
{
"name": "Stadtbibliothek Rudolstadt",
"city": "Rudolstadt",
"zip": "07407",
"street": "Schulplatz 13",
"phone": "0 36 72 - 48 64 20",
"fax": "0 36 72 - 48 64 30",
"web": "http://www.stadtbibliothek-rudolstadt.de ",
"email": "stadtbibliothek@rudolstadt.de",
"rel": "organizer"
}
],
"created": "2099-11-10T23:02:00+00:00",
"changed": "2099-12-14T08:28:00+00:00",
"source": {
"url": "http://destination.one/",
"value": "destination.one"
},
"company": "",
"postoffice": "",
"phone2": "",
"seasons": [],
"subitems": [],
"hyperObjects": []
},
{
"global_id": "e_100350503",
"id": "100350503",
"title": "Adventliche Orgelmusik (Orgel: KMD Frank Bettenhausen)",
"type": "Event",
"categories": [
"Konzerte, Festivals, Show & Tanz",
"Weihnachten"
],
"texts": [
{
"rel": "details",
"type": "text/html",
"value": "Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906.&nbsp;&nbsp;Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.<br><br><strong>Es gilt die 2G-PLUS-Regel.</strong><br>"
},
{
"rel": "details",
"type": "text/plain",
"value": "Immer mittwochs in der Adventszeit spielt Frank Bettenhausen solo und zusammen mit anderen Musikern auf der Steinmeyerorgel aus dem Jahr 1906. Bekannte Adventslieder, barocke und romantische Kompositionen stehen neben besinnlichen Texten von Pfarrer Johannes-Martin Weiss.\n\nEs gilt die 2G-PLUS-Regel."
},
{
"rel": "teaser",
"type": "text/html"
},
{
"rel": "teaser",
"type": "text/plain"
}
],
"areas": [
"Rudolstadt und Umgebung"
],
"name": "Schillerhaus Rudolstadt",
"street": "Other address",
"zip": "07407",
"city": "Rudolstadt",
"district": "",
"country": "Deutschland",
"phone": "+ 49 3672 / 486470",
"geo": {
"main": {
"latitude": 50.720971023258805,
"longitude": 11.335229873657227
},
"entry": [],
"attributes": []
},
"author": "support@hubermedia.de",
"ratings": [
{
"type": "eT4",
"value": 40.0
},
{
"type": "order",
"value": 99.0001
}
],
"cuisine_types": [],
"payment": [],
"media_objects": [
],
"keywords": [],
"timeIntervals": [
{
"weekdays": [],
"start": "2099-12-01T19:00:00+01:00",
"end": "2099-12-01T20:00:00+01:00",
"tz": "Europe/Berlin",
"interval": 1
},
{
"weekdays": [
"Saturday",
"Sunday"
],
"start": "2099-11-02T11:00:00+01:00",
"end": "2099-11-02T13:00:00+01:00",
"repeatUntil": "2099-11-25T13:00:00+01:00",
"tz": "Europe/Berlin",
"freq": "Weekly",
"interval": 1
},
{
"weekdays": [],
"start": "2099-12-22T19:00:00+01:00",
"end": "2099-12-22T20:00:00+01:00",
"tz": "Europe/Berlin",
"interval": 1
}
],
"kitchenTimeIntervals": [],
"deliveryTimeIntervals": [],
"numbers": [],
"attributes": [
{
"key": "VO_Id",
"value": "100118350"
},
{
"key": "VO_CategoryName",
"value": "POI"
},
{
"key": "VA_Id",
"value": "100118350"
},
{
"key": "VA_CategoryName",
"value": "POI"
},
{
"key": "interval_first_match_start",
"value": "2099-12-15T19:00:00+01"
},
{
"key": "interval_first_match_end",
"value": "2099-12-15T20:00:00+01"
},
{
"key": "interval_match_count",
"value": "2"
},
{
"key": "interval_last_match_start",
"value": "2099-12-22T19:00:00+01"
},
{
"key": "interval_last_match_end",
"value": "2099-12-22T20:00:00+01"
}
],
"features": [],
"addresses": [
{
"name": "Städtetourismus in Thüringen e.V.",
"city": "Weimar",
"zip": "99423",
"street": "UNESCO-Platz 1",
"phone": "+49 (3643) 745 314",
"web": "http://www.thueringer-staedte.de",
"email": "verein@thueringer-staedte.de",
"rel": "author"
},
{
"name": "Städtetourismus in Thüringen\" e.V.",
"web": "http://www.thueringer-staedte.de",
"email": "verein@thueringer-staedte.de",
"rel": "organisation"
},
{
"name": "Lutherkirche",
"city": "Rudolstadt",
"zip": "07407",
"street": "Caspar-Schulte-Straße",
"phone": "03672 - 48 96 13",
"rel": "organizer"
}
],
"created": "2099-11-08T22:15:00+00:00",
"changed": "2099-12-14T08:38:00+00:00",
"source": {
"url": "http://destination.one/",
"value": "destination.one"
},
"company": "",
"postoffice": "",
"phone2": "",
"seasons": [],
"subitems": [],
"hyperObjects": []
}
]
}

View file

@ -0,0 +1,49 @@
<?php
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
use GuzzleHttp\Psr7\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* @testdox DestinationData import
*/
class ImportsWithLocationsTest extends AbstractTest
{
/**
* @test
*/
public function importsWithLocations(): void
{
$fileImportPathConfiguration = 'staedte/beispielstadt/events/';
$fileImportPath = $this->getInstancePath() . '/fileadmin/' . $fileImportPathConfiguration;
GeneralUtility::mkdir_deep($fileImportPath);
$this->setUpConfiguration([
'restUrl = https://example.com/some-path/',
'license = example-license',
'restType = Event',
'restLimit = 3',
'restMode = next_months,12',
'restTemplate = ET2014A.json',
]);
$requests = &$this->setUpResponses([
new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithLocations.json') ?: ''),
]);
$tester = $this->executeCommand([
'storage-pid' => '2',
'rest-experience' => 'beispielstadt',
'files-folder' => $fileImportPathConfiguration,
'region-uid' => '',
]);
self::assertSame(0, $tester->getStatusCode());
$this->assertCSVDataSet('EXT:events/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithLocations.csv');
self::assertFileEquals(
__DIR__ . '/Assertions/EmptyLogFile.txt',
$this->getInstancePath() . '/typo3temp/var/log/typo3_0493d91d8e.log',
'Logfile was not empty.'
);
}
}

View file

@ -155,7 +155,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'', '',
'',
-1 -1
)); ));
@ -181,7 +180,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'', '',
'',
-1 -1
)); ));
@ -207,7 +205,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'', '',
'',
-1 -1
)); ));
@ -233,7 +230,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'', '',
'',
-1 -1
)); ));
@ -259,7 +255,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'', '',
'',
-1 -1
)); ));
@ -285,7 +280,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'', '',
'',
-1 -1
)); ));
@ -311,7 +305,6 @@ class LocationDataTest extends TestCase
'+49 2161 333 333 333', '+49 2161 333 333 333',
'', '',
'', '',
'',
-1 -1
)); ));
@ -337,7 +330,6 @@ class LocationDataTest extends TestCase
'', '',
'50.720971023259', '50.720971023259',
'', '',
'',
-1 -1
)); ));
@ -363,7 +355,6 @@ class LocationDataTest extends TestCase
'', '',
'', '',
'11.335229873657', '11.335229873657',
'',
-1 -1
)); ));

View file

@ -119,7 +119,6 @@ CREATE TABLE tx_events_domain_model_import (
CREATE TABLE tx_events_domain_model_location ( CREATE TABLE tx_events_domain_model_location (
global_id varchar(255) DEFAULT '' NOT NULL, global_id varchar(255) DEFAULT '' NOT NULL,
slug varchar(255) DEFAULT '' NOT NULL,
name varchar(255) DEFAULT '' NOT NULL, name varchar(255) DEFAULT '' NOT NULL,
street varchar(255) DEFAULT '' NOT NULL, street varchar(255) DEFAULT '' NOT NULL,
city varchar(255) DEFAULT '' NOT NULL, city varchar(255) DEFAULT '' NOT NULL,