2021-02-01 14:14:05 +01:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
2021-08-10 09:38:59 +02:00
|
|
|
namespace WerkraumMedia\ThueCat\Domain\Import\Model;
|
|
|
|
|
2021-02-01 14:14:05 +01:00
|
|
|
class GenericEntity implements Entity
|
|
|
|
{
|
2023-12-04 15:19:20 +01:00
|
|
|
private int $typo3StoragePid;
|
2021-04-13 14:43:04 +02:00
|
|
|
|
2023-12-04 15:19:20 +01:00
|
|
|
private string $typo3DatabaseTableName;
|
2021-04-13 14:43:04 +02:00
|
|
|
|
2023-12-04 15:19:20 +01:00
|
|
|
private int $typo3SystemLanguageUid;
|
2021-04-13 14:43:04 +02:00
|
|
|
|
2023-12-04 15:19:20 +01:00
|
|
|
private bool $created = false;
|
2021-04-13 14:43:04 +02:00
|
|
|
|
2023-12-04 15:19:20 +01:00
|
|
|
private int $typo3Uid = 0;
|
2021-04-13 14:43:04 +02:00
|
|
|
|
2023-12-04 15:19:20 +01:00
|
|
|
private string $remoteId;
|
2021-04-13 14:43:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var mixed[]
|
|
|
|
*/
|
2023-12-04 15:19:20 +01:00
|
|
|
private array $data;
|
2021-02-01 14:14:05 +01:00
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
int $typo3StoragePid,
|
|
|
|
string $typo3DatabaseTableName,
|
2021-02-03 17:20:01 +01:00
|
|
|
int $typo3SystemLanguageUid,
|
2021-02-01 14:14:05 +01:00
|
|
|
string $remoteId,
|
|
|
|
array $data
|
|
|
|
) {
|
|
|
|
$this->typo3StoragePid = $typo3StoragePid;
|
|
|
|
$this->typo3DatabaseTableName = $typo3DatabaseTableName;
|
2021-02-03 17:20:01 +01:00
|
|
|
$this->typo3SystemLanguageUid = $typo3SystemLanguageUid;
|
2021-02-01 14:14:05 +01:00
|
|
|
$this->remoteId = $remoteId;
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTypo3StoragePid(): int
|
|
|
|
{
|
|
|
|
return $this->typo3StoragePid;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTypo3DatabaseTableName(): string
|
|
|
|
{
|
|
|
|
return $this->typo3DatabaseTableName;
|
|
|
|
}
|
|
|
|
|
2021-02-03 17:20:01 +01:00
|
|
|
public function getTypo3SystemLanguageUid(): int
|
|
|
|
{
|
|
|
|
return $this->typo3SystemLanguageUid;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isForDefaultLanguage(): bool
|
|
|
|
{
|
|
|
|
return $this->getTypo3SystemLanguageUid() === 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isTranslation(): bool
|
|
|
|
{
|
|
|
|
return $this->getTypo3SystemLanguageUid() !== 0;
|
|
|
|
}
|
|
|
|
|
2021-02-01 14:14:05 +01:00
|
|
|
public function getRemoteId(): string
|
|
|
|
{
|
|
|
|
return $this->remoteId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getData(): array
|
|
|
|
{
|
|
|
|
return $this->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setImportedTypo3Uid(int $uid): void
|
|
|
|
{
|
|
|
|
$this->typo3Uid = $uid;
|
|
|
|
$this->created = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setExistingTypo3Uid(int $uid): void
|
|
|
|
{
|
|
|
|
$this->typo3Uid = $uid;
|
|
|
|
$this->created = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTypo3Uid(): int
|
|
|
|
{
|
|
|
|
return $this->typo3Uid;
|
|
|
|
}
|
|
|
|
|
2021-02-16 17:12:47 +01:00
|
|
|
public function exists(): bool
|
|
|
|
{
|
|
|
|
return $this->getTypo3Uid() !== 0;
|
|
|
|
}
|
|
|
|
|
2021-02-01 14:14:05 +01:00
|
|
|
public function wasCreated(): bool
|
|
|
|
{
|
|
|
|
return $this->created;
|
|
|
|
}
|
|
|
|
}
|