mirror of
https://github.com/werkraum-media/thuecat.git
synced 2024-12-05 03:26:13 +01:00
Cleanup refactoring after big refactoring
This commit is contained in:
parent
bfd4c77a17
commit
7c8dd0df3b
13 changed files with 261 additions and 304 deletions
|
@ -24,41 +24,11 @@ declare(strict_types=1);
|
|||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ManagedBy;
|
||||
|
||||
|
||||
class Base
|
||||
class Base extends Minimum
|
||||
{
|
||||
/**
|
||||
* URL to the original source at ThüCAT.
|
||||
* Not unique within our system. We have one entity per language,
|
||||
* while ThüCAT has a single entity containing all languages.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id = '';
|
||||
|
||||
/**
|
||||
* Short name of the thing.
|
||||
* Can be translated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* Long text describing the thing.
|
||||
* Can be translated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* URL to official version of this thing outside of ThüCAT.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $url = '';
|
||||
use ManagedBy;
|
||||
|
||||
/**
|
||||
* @var ForeignReference
|
||||
|
@ -72,38 +42,6 @@ class Base
|
|||
*/
|
||||
protected $images = [];
|
||||
|
||||
/**
|
||||
* The Thing responsible for the data within this Thing.
|
||||
*
|
||||
* @var ForeignReference
|
||||
*/
|
||||
protected $managedBy;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function hasName(): bool
|
||||
{
|
||||
return trim($this->name) !== '';
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getPhoto(): ?ForeignReference
|
||||
{
|
||||
return $this->photo;
|
||||
|
@ -117,43 +55,6 @@ class Base
|
|||
return $this->images;
|
||||
}
|
||||
|
||||
public function getManagedBy(): ?ForeignReference
|
||||
{
|
||||
return $this->managedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setId(string $url): void
|
||||
{
|
||||
$this->id = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setUrl(string $url): void
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
|
@ -185,17 +86,4 @@ class Base
|
|||
public function removeImage(ForeignReference $image): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setContentResponsible(ForeignReference $contentResponsible): void
|
||||
{
|
||||
$this->managedBy = $contentResponsible;
|
||||
}
|
||||
|
||||
// TODO: Address
|
||||
// TODO: Offers
|
||||
|
||||
// TODO: containedInPlace -> resolve to town, etc.
|
||||
}
|
||||
|
|
|
@ -23,23 +23,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
class MediaObject implements MapsToType
|
||||
class MediaObject extends Minimum implements MapsToType
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $url = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -60,21 +45,6 @@ class MediaObject implements MapsToType
|
|||
*/
|
||||
protected $type = '';
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getCopyrightYear(): int
|
||||
{
|
||||
return $this->copyrightYear;
|
||||
|
@ -95,30 +65,6 @@ class MediaObject implements MapsToType
|
|||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setUrl(string $url): void
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
|
|
116
Classes/Domain/Import/Entity/Minimum.php
Normal file
116
Classes/Domain/Import/Entity/Minimum.php
Normal file
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
class Minimum
|
||||
{
|
||||
/**
|
||||
* URL to the original source at ThüCAT.
|
||||
* Not unique within our system. We have one entity per language,
|
||||
* while ThüCAT has a single entity containing all languages.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id = '';
|
||||
|
||||
/**
|
||||
* Short name of the thing.
|
||||
* Can be translated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* Long text describing the thing.
|
||||
* Can be translated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* URL to official version of this thing outside of ThüCAT.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $url = '';
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function hasName(): bool
|
||||
{
|
||||
return trim($this->name) !== '';
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setId(string $url): void
|
||||
{
|
||||
$this->id = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setUrl(string $url): void
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
}
|
|
@ -24,14 +24,15 @@ declare(strict_types=1);
|
|||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\Address;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\Geo;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\OpeningHour;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ContainedInPlace;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\Organization;
|
||||
|
||||
class Place extends Base
|
||||
{
|
||||
use Organization;
|
||||
use ContainedInPlace;
|
||||
|
||||
/**
|
||||
* @var Address
|
||||
|
@ -48,11 +49,6 @@ class Place extends Base
|
|||
*/
|
||||
protected $openingHours = [];
|
||||
|
||||
/**
|
||||
* @var ForeignReference[]
|
||||
*/
|
||||
protected $containedInPlace = [];
|
||||
|
||||
public function getAddress(): ?Address
|
||||
{
|
||||
return $this->address;
|
||||
|
@ -63,14 +59,6 @@ class Place extends Base
|
|||
return $this->geo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ForeignReference[]
|
||||
*/
|
||||
public function getContainedInPlaces(): array
|
||||
{
|
||||
return $this->containedInPlace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
|
@ -110,28 +98,4 @@ class Place extends Base
|
|||
public function removeOpeningHoursSpecification(OpeningHour $openingHour): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ForeignReference[]
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function getContainedInPlace(): array
|
||||
{
|
||||
return $this->containedInPlace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function addContainedInPlace(ForeignReference $place): void
|
||||
{
|
||||
$this->containedInPlace[] = $place;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function removeContainedInPlace(ForeignReference $place): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,33 +23,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
|
||||
|
||||
class Offer
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Minimum;
|
||||
|
||||
class Offer extends Minimum
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* @var PriceSpecification[]
|
||||
*/
|
||||
protected $prices = [];
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PriceSpecification[]
|
||||
*/
|
||||
|
@ -58,22 +40,6 @@ class Offer
|
|||
return $this->prices;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PriceSpecification[]
|
||||
* @internal for mapping via Symfony component.
|
||||
|
|
|
@ -23,21 +23,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
|
||||
|
||||
class PriceSpecification
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Minimum;
|
||||
|
||||
class PriceSpecification extends Minimum
|
||||
{
|
||||
// TODO: Move name to trait
|
||||
// TODO: Move description to trait
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
|
@ -59,16 +48,6 @@ class PriceSpecification
|
|||
*/
|
||||
protected $calculationRule = '';
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getPrice(): float
|
||||
{
|
||||
return $this->price;
|
||||
|
@ -84,22 +63,6 @@ class PriceSpecification
|
|||
return $this->calculationRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
|
|
66
Classes/Domain/Import/Entity/Shared/ContainedInPlace.php
Normal file
66
Classes/Domain/Import/Entity/Shared/ContainedInPlace.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Shared;
|
||||
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
||||
|
||||
trait ContainedInPlace
|
||||
{
|
||||
/**
|
||||
* @var ForeignReference[]
|
||||
*/
|
||||
protected $containedInPlace = [];
|
||||
|
||||
/**
|
||||
* @return ForeignReference[]
|
||||
*/
|
||||
public function getContainedInPlaces(): array
|
||||
{
|
||||
return $this->containedInPlace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ForeignReference[]
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function getContainedInPlace(): array
|
||||
{
|
||||
return $this->containedInPlace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function addContainedInPlace(ForeignReference $place): void
|
||||
{
|
||||
$this->containedInPlace[] = $place;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function removeContainedInPlace(ForeignReference $place): void
|
||||
{
|
||||
}
|
||||
}
|
49
Classes/Domain/Import/Entity/Shared/ManagedBy.php
Normal file
49
Classes/Domain/Import/Entity/Shared/ManagedBy.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Shared;
|
||||
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
||||
|
||||
trait ManagedBy
|
||||
{
|
||||
/**
|
||||
* The Thing responsible for the data within this Thing.
|
||||
*
|
||||
* @var ForeignReference
|
||||
*/
|
||||
protected $managedBy;
|
||||
|
||||
public function getManagedBy(): ?ForeignReference
|
||||
{
|
||||
return $this->managedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal for mapping via Symfony component.
|
||||
*/
|
||||
public function setContentResponsible(ForeignReference $contentResponsible): void
|
||||
{
|
||||
$this->managedBy = $contentResponsible;
|
||||
}
|
||||
}
|
|
@ -23,9 +23,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
class TouristInformation extends Place implements MapsToType
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ContainedInPlace;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ManagedBy;
|
||||
|
||||
class TouristInformation extends Minimum implements MapsToType
|
||||
{
|
||||
// TODO: Only has title and description which should be moved to trait anyway
|
||||
use ManagedBy;
|
||||
use ContainedInPlace;
|
||||
|
||||
public static function getSupportedTypes(): array
|
||||
{
|
||||
|
|
|
@ -23,10 +23,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
class TouristMarketingCompany extends Base implements MapsToType
|
||||
class TouristMarketingCompany extends Minimum implements MapsToType
|
||||
{
|
||||
// TODO: Only has title and description which should be moved to trait anyway
|
||||
|
||||
public static function getSupportedTypes(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
@ -23,9 +23,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
|
||||
|
||||
class Town extends Base implements MapsToType
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ManagedBy;
|
||||
|
||||
class Town extends Minimum implements MapsToType
|
||||
{
|
||||
// TODO: Only has title and description which should be moved to trait anyway
|
||||
use ManagedBy;
|
||||
|
||||
public static function getSupportedTypes(): array
|
||||
{
|
||||
|
|
|
@ -48,8 +48,7 @@ class LanguageHandling implements Languages
|
|||
|
||||
public function getLanguageUidForString(int $pageUid, string $isoCode): int
|
||||
{
|
||||
$languages = $this->siteFinder->getSiteByPageId($pageUid)->getLanguages();
|
||||
foreach ($languages as $language) {
|
||||
foreach ($this->getLanguages($pageUid) as $language) {
|
||||
if ($language->getTwoLetterIsoCode() === $isoCode) {
|
||||
return $language->getLanguageId();
|
||||
}
|
||||
|
@ -65,18 +64,11 @@ class LanguageHandling implements Languages
|
|||
);
|
||||
}
|
||||
|
||||
// TODO: Check usages and remove below methods
|
||||
|
||||
/**
|
||||
* @return SiteLanguage[]
|
||||
*/
|
||||
public function getLanguages(int $pageUid): array
|
||||
private function getLanguages(int $pageUid): array
|
||||
{
|
||||
return $this->siteFinder->getSiteByPageId($pageUid)->getLanguages();
|
||||
}
|
||||
|
||||
public function getDefaultLanguage(int $pageUid): SiteLanguage
|
||||
{
|
||||
return $this->siteFinder->getSiteByPageId($pageUid)->getDefaultLanguage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace WerkraumMedia\ThueCat\Domain\Repository\Backend;
|
|||
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
||||
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
|
||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Place;
|
||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Backend\Town;
|
||||
|
||||
|
@ -43,8 +42,12 @@ class TownRepository extends Repository
|
|||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
|
||||
public function findOneByEntity(Place $entity): ?Town
|
||||
public function findOneByEntity(object $entity): ?Town
|
||||
{
|
||||
if (method_exists($entity, 'getContainedInPlaces') === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$remoteIds = array_map(function (ForeignReference $reference) {
|
||||
return $reference->getId();
|
||||
}, $entity->getContainedInPlaces());
|
||||
|
|
Loading…
Reference in a new issue