mirror of
https://github.com/werkraum-media/thuecat.git
synced 2024-11-16 10:16:12 +01:00
Manually fix issues arisen from auto fixing stuff
This commit is contained in:
parent
65898e97e0
commit
1ec50a526f
20 changed files with 85 additions and 23 deletions
|
@ -30,7 +30,7 @@ class Base extends Minimum
|
|||
{
|
||||
use ManagedBy;
|
||||
|
||||
protected ForeignReference $photo;
|
||||
protected ?ForeignReference $photo = null;
|
||||
|
||||
/**
|
||||
* Images of this Thing.
|
||||
|
|
|
@ -39,9 +39,9 @@ class Place extends Base
|
|||
use Organization;
|
||||
use ContainedInPlace;
|
||||
|
||||
protected Address $address;
|
||||
protected ?Address $address = null;
|
||||
|
||||
protected Geo $geo;
|
||||
protected ?Geo $geo = null;
|
||||
|
||||
/**
|
||||
* @var OpeningHour[]
|
||||
|
@ -80,7 +80,7 @@ class Place extends Base
|
|||
|
||||
protected string $distanceToPublicTransport = '';
|
||||
|
||||
protected ForeignReference $accessibilitySpecification;
|
||||
protected ?ForeignReference $accessibilitySpecification = null;
|
||||
|
||||
public function getAddress(): ?Address
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ trait ManagedBy
|
|||
/**
|
||||
* The Thing responsible for the data within this Thing.
|
||||
*/
|
||||
protected ?ForeignReference $managedBy;
|
||||
protected ?ForeignReference $managedBy = null;
|
||||
|
||||
public function getManagedBy(): ?ForeignReference
|
||||
{
|
||||
|
|
|
@ -235,7 +235,7 @@ class JsonDecode extends SymfonyJsonDecode
|
|||
private function doesRuleMatch(array $rule, string $type): bool
|
||||
{
|
||||
if ($rule['type'] === 'beginsWith') {
|
||||
return str_starts_with($type, (string) $rule['comparisonValue']);
|
||||
return str_starts_with($type, (string)$rule['comparisonValue']);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -59,7 +59,7 @@ class NameExtractor
|
|||
}
|
||||
|
||||
if ($name === '' && method_exists($remote, 'getName')) {
|
||||
$name = trim((string) $remote->getName());
|
||||
$name = trim((string)$remote->getName());
|
||||
}
|
||||
|
||||
return $name;
|
||||
|
|
|
@ -31,7 +31,12 @@ class MappingError extends ImportLogEntry
|
|||
{
|
||||
protected string $remoteId = '';
|
||||
|
||||
protected string $errors = '';
|
||||
/**
|
||||
* Necessary for Extbase/Symfony.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $errors = '[]';
|
||||
|
||||
public function __construct(
|
||||
MappingException $exception
|
||||
|
@ -47,7 +52,7 @@ class MappingError extends ImportLogEntry
|
|||
|
||||
public function getErrors(): array
|
||||
{
|
||||
$errors = json_decode($this->errors, true, 512, JSON_THROW_ON_ERROR);
|
||||
$errors = json_decode($this->errors, true);
|
||||
if (is_array($errors) === false) {
|
||||
throw new Exception('Could not parse errors.', 1671097690);
|
||||
}
|
||||
|
|
|
@ -41,18 +41,24 @@ class SavingEntity extends ImportLogEntry
|
|||
|
||||
protected string $errors = '';
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected array $errorsAsArray = [];
|
||||
|
||||
/**
|
||||
* @param string[] $errorsAsArray
|
||||
*/
|
||||
public function __construct(
|
||||
Entity $entity,
|
||||
protected array $errorsAsArray
|
||||
array $errorsAsArray
|
||||
) {
|
||||
$this->remoteId = $entity->getRemoteId();
|
||||
$this->insertion = $entity->wasCreated();
|
||||
$this->recordUid = $entity->getTypo3Uid();
|
||||
$this->recordPid = $entity->getTypo3StoragePid();
|
||||
$this->tableName = $entity->getTypo3DatabaseTableName();
|
||||
$this->errorsAsArray = $errorsAsArray;
|
||||
}
|
||||
|
||||
public function getRemoteId(): string
|
||||
|
|
|
@ -35,7 +35,7 @@ class AccessiblitySpecification implements TypeInterface
|
|||
public function __construct(
|
||||
private readonly string $serialized
|
||||
) {
|
||||
$this->data = json_decode($serialized, true, 512, JSON_THROW_ON_ERROR);
|
||||
$this->data = json_decode($serialized, true);
|
||||
}
|
||||
|
||||
public function getCertificationStatus(): string
|
||||
|
|
|
@ -35,7 +35,7 @@ class Address implements TypeInterface
|
|||
public function __construct(
|
||||
private readonly string $serialized
|
||||
) {
|
||||
$this->data = json_decode($serialized, true, 512, JSON_THROW_ON_ERROR);
|
||||
$this->data = json_decode($serialized, true) ?? [];
|
||||
}
|
||||
|
||||
public function getStreet(): string
|
||||
|
|
|
@ -41,7 +41,7 @@ class Media implements TypeInterface
|
|||
public function __construct(
|
||||
private readonly string $serialized
|
||||
) {
|
||||
$data = json_decode($serialized, true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = json_decode($serialized, true);
|
||||
$this->data = $this->prepareData(is_array($data) ? $data : []);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Offers implements TypeInterface, Iterator, Countable
|
|||
public function __construct(
|
||||
private readonly string $serialized
|
||||
) {
|
||||
$array = json_decode($serialized, true, 512, JSON_THROW_ON_ERROR);
|
||||
$array = json_decode($serialized, true);
|
||||
if (is_array($array)) {
|
||||
$array = array_map([Offer::class, 'createFromArray'], $array);
|
||||
usort($array, function (Offer $offerA, Offer $offerB) {
|
||||
|
|
|
@ -52,7 +52,7 @@ class OpeningHours implements TypeInterface, Iterator, Countable
|
|||
{
|
||||
$array = array_map(
|
||||
[OpeningHour::class, 'createFromArray'],
|
||||
json_decode($serialized, true, 512, JSON_THROW_ON_ERROR) ?? []
|
||||
json_decode($serialized, true) ?? []
|
||||
);
|
||||
|
||||
$array = GeneralUtility::makeInstance(DateBasedFilter::class)
|
||||
|
|
|
@ -41,14 +41,29 @@ abstract class Place extends Base
|
|||
*/
|
||||
protected ObjectStorage $parkingFacilityNearBy;
|
||||
|
||||
/**
|
||||
* Necessary for Extbase/Symfony.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $sanitation = '';
|
||||
|
||||
protected string $otherService = '';
|
||||
|
||||
protected string $trafficInfrastructure = '';
|
||||
|
||||
/**
|
||||
* Necessary for Extbase/Symfony.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $paymentAccepted = '';
|
||||
|
||||
/**
|
||||
* Necessary for Extbase/Symfony.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $distanceToPublicTransport = '';
|
||||
|
||||
protected ?AccessiblitySpecification $accessibilitySpecification = null;
|
||||
|
|
|
@ -39,8 +39,18 @@ class TouristAttraction extends Place
|
|||
|
||||
protected string $architecturalStyle = '';
|
||||
|
||||
/**
|
||||
* Necessary for Extbase/Symfony.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $digitalOffer = '';
|
||||
|
||||
/**
|
||||
* Necessary for Extbase/Symfony.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $photography = '';
|
||||
|
||||
protected string $petsAllowed = '';
|
||||
|
|
|
@ -11,7 +11,9 @@ use WerkraumMedia\ThueCat\Domain\Model\Backend\Organisation;
|
|||
use WerkraumMedia\ThueCat\Domain\Model\Backend\ParkingFacility;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Backend\TouristInformation;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Backend\Town;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Frontend\TouristAttraction;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Frontend\ParkingFacility as FrontendParkingFacility;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Frontend\TouristAttraction as FrontendTouristAttraction;
|
||||
use WerkraumMedia\ThueCat\Domain\Model\Frontend\Town as FrontendTown;
|
||||
|
||||
return [
|
||||
Organisation::class => [
|
||||
|
@ -47,7 +49,14 @@ return [
|
|||
'tableName' => 'tx_thuecat_import_log_entry',
|
||||
'recordType' => 'mappingError',
|
||||
],
|
||||
TouristAttraction::class => [
|
||||
|
||||
FrontendTouristAttraction::class => [
|
||||
'tableName' => 'tx_thuecat_tourist_attraction',
|
||||
],
|
||||
FrontendTown::class => [
|
||||
'tableName' => 'tx_thuecat_town',
|
||||
],
|
||||
FrontendParkingFacility::class => [
|
||||
'tableName' => 'tx_thuecat_parking_facility',
|
||||
],
|
||||
];
|
||||
|
|
|
@ -14,4 +14,4 @@ Those changes are documented so we know what to do once we drop an older version
|
|||
:glob:
|
||||
:reversed:
|
||||
|
||||
Maintenance/PHP/*
|
||||
Maintenance/*
|
||||
|
|
15
Documentation/Maintenance/Extbase.rst
Normal file
15
Documentation/Maintenance/Extbase.rst
Normal file
|
@ -0,0 +1,15 @@
|
|||
.. _maintenanceExtbase:
|
||||
|
||||
Extbase
|
||||
=======
|
||||
|
||||
PHPDoc Blocks with type hints mentioning `Necessary for Extbase/Symfony.`
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Those are necessary (at least with TYPO3 v12) because of Extbase and the underlying
|
||||
Symfony component.
|
||||
|
||||
Extbase uses the PHPDocExtractor first, before using the `ReflectionExtractor`, both part of Symfony property-info package.
|
||||
The `ReflectionExtractor` will check the mutator followed by accessors prior checking the property itself.
|
||||
Some of our properties have different return values by accessors than the stored value that is set to the property.
|
||||
We therefore need to keep the PHPDoc block as this is checked first.
|
|
@ -71,10 +71,10 @@
|
|||
</f:if>
|
||||
</div>
|
||||
<div class="row thuecat__services">
|
||||
<f:if condition="{entity.generalInformation || entity.otherServices || entity.petsAllowed || entity.isAccessibleForFree
|
||||
|| entity.publicAccess || entity.accessibilitySpecification.certificationStatus || entity.museumServices
|
||||
|| entity.digitalOffer || entity.trafficInfrastructures || entity.paymentAccepted || entity.availableLanguages
|
||||
|| entity.sanitation || entity.photography || entity.startOfConstruction || entity.architecturalStyles}"
|
||||
<f:if condition="{entity.generalInformation} || {entity.otherServices} || {entity.petsAllowed} || {entity.isAccessibleForFree}
|
||||
|| {entity.publicAccess} || {entity.accessibilitySpecification.certificationStatus} || {entity.museumServices}
|
||||
|| {entity.digitalOffer} || {entity.trafficInfrastructures} || {entity.paymentAccepted} || {entity.availableLanguages}
|
||||
|| {entity.sanitation} || {entity.photography} || {entity.startOfConstruction} || {entity.architecturalStyles}"
|
||||
>
|
||||
<div class="col-md-6">
|
||||
<h2>{f:translate(id: 'content.generalInformation', extensionName: 'Thuecat')}</h2>
|
||||
|
@ -109,6 +109,7 @@
|
|||
</f:if>
|
||||
<f:if condition="{entity.sanitation}">
|
||||
<h3>{f:translate(id: 'content.sanitation', extensionName: 'Thuecat')}</h3>
|
||||
sanitation
|
||||
{f:render(partial: 'Sanitation', arguments: {sanitation: entity.sanitation})}
|
||||
</f:if>
|
||||
<f:if condition="{entity.photography}">
|
||||
|
|
|
@ -103,7 +103,7 @@ class FetchDataTest extends TestCase
|
|||
$httpClient->method('sendRequest')->willReturn($response);
|
||||
|
||||
$body = $this->createStub(StreamInterface::class);
|
||||
$body->method('__toString')->willReturn('');
|
||||
$body->method('__toString')->willReturn('[]');
|
||||
|
||||
$response->method('getStatusCode')->willReturn(200);
|
||||
$response->method('getBody')->willReturn($body);
|
||||
|
|
|
@ -53,6 +53,7 @@ class GeneralConverterTest extends TestCase
|
|||
$parkingFacilityRepository = $this->createStub(ParkingFacilityRepository::class);
|
||||
$nameExtractor = $this->createStub(NameExtractor::class);
|
||||
$logManager = $this->createStub(LogManager::class);
|
||||
$logManager->method('getLogger')->willReturn($this->createStub(Logger::class));
|
||||
|
||||
$subject = new GeneralConverter(
|
||||
$resolveForeignReference,
|
||||
|
|
Loading…
Reference in a new issue