Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update for v12 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions Classes/Domain/Model/FileReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ class FileReference extends \TYPO3\CMS\Extbase\Domain\Model\FileReference
* Set File uid
*
* @param int $fileUid
* @return void
*/
public function setFileUid($fileUid)
public function setFileUid($fileUid): void
{
$this->uidLocal = $fileUid;
}
Expand All @@ -92,9 +91,8 @@ public function getFileUid()
* Set alternative
*
* @param string $alternative
* @return void
*/
public function setAlternative($alternative)
public function setAlternative($alternative): void
{
$this->alternative = $alternative;
}
Expand All @@ -113,9 +111,8 @@ public function getAlternative()
* Set description
*
* @param string $description
* @return void
*/
public function setDescription($description)
public function setDescription($description): void
{
$this->description = $description;
}
Expand All @@ -134,9 +131,8 @@ public function getDescription()
* Set link
*
* @param string $link
* @return void
*/
public function setLink($link)
public function setLink($link): void
{
$this->link = $link;
}
Expand All @@ -156,9 +152,8 @@ public function getLink()
* Set title
*
* @param string $title
* @return void
*/
public function setTitle($title)
public function setTitle($title): void
{
$this->title = $title;
}
Expand All @@ -177,9 +172,8 @@ public function getTitle()
* Set showinpreview
*
* @param bool $showinpreview
* @return void
*/
public function setShowinpreview($showinpreview)
public function setShowinpreview($showinpreview): void
{
$this->showinpreview = $showinpreview;
}
Expand All @@ -194,18 +188,12 @@ public function getShowinpreview()
return $this->showinpreview;
}

/**
* @param \TYPO3\CMS\Core\Resource\ResourceInterface $originalResource
*/
public function setOriginalResource(\TYPO3\CMS\Core\Resource\ResourceInterface $originalResource) {
public function setOriginalResource(\TYPO3\CMS\Core\Resource\ResourceInterface $originalResource): void {
$this->originalResource = $originalResource;
$this->originalFileIdentifier = (int)$originalResource->getOriginalFile()->getUid();
}

/**
* @param \TYPO3\CMS\Core\Resource\File $falFile
*/
public function setFile(\TYPO3\CMS\Core\Resource\File $falFile) {
public function setFile(\TYPO3\CMS\Core\Resource\File $falFile): void {
$this->originalFileIdentifier = (int)$falFile->getUid();
}

Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Model/ImportedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getSourceUniqueIdentifier()
/**
* @param string $sourceUniqueIdentifier
*/
public function setSourceUniqueIdentifier($sourceUniqueIdentifier)
public function setSourceUniqueIdentifier($sourceUniqueIdentifier): void
{
$this->sourceUniqueIdentifier = $sourceUniqueIdentifier;
}
Expand All @@ -95,7 +95,7 @@ public function getSourceFieldHashes()
/**
* @param array $sourceFieldHashes
*/
public function setSourceFieldHashes($sourceFieldHashes)
public function setSourceFieldHashes($sourceFieldHashes): void
{
$this->sourceFieldHashes = $sourceFieldHashes;
}
Expand All @@ -111,7 +111,7 @@ public function getInternalUid()
/**
* @param int $internalUid
*/
public function setInternalUid($internalUid)
public function setInternalUid($internalUid): void
{
$this->internalUid = $internalUid;
}
Expand All @@ -127,7 +127,7 @@ public function getInternalPid()
/**
* @param pid $internalPid
*/
public function setInternalPid($internalPid)
public function setInternalPid($internalPid): void
{
$this->internalPid = $internalPid;
}
Expand All @@ -143,7 +143,7 @@ public function getInternalEntityClassname()
/**
* @param string $internalEntityClassName
*/
public function setInternalEntityClassName($internalEntityClassname)
public function setInternalEntityClassName($internalEntityClassname): void
{
$this->internalEntityClassname = $internalEntityClassname;
}
Expand All @@ -159,7 +159,7 @@ public function getInternalLanguage()
/**
* @param int $language
*/
public function setInternalLanguage($internalLanguage)
public function setInternalLanguage($internalLanguage): void
{
$this->internalLanguage = $internalLanguage;
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/Domain/Model/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getSource()
/**
* @param string $source
*/
public function setSource($source)
public function setSource($source): void
{
$this->source = $source;
}
Expand All @@ -100,7 +100,7 @@ public function getSourceData()
/**
* @param string $sourceData
*/
public function setSourceData($sourceData)
public function setSourceData($sourceData): void
{
$this->sourceData = $sourceData;
}
Expand All @@ -116,7 +116,7 @@ public function getFilename()
/**
* @param string $filename
*/
public function setFilename($filename)
public function setFilename($filename): void
{
$this->filename = $filename;
}
Expand All @@ -132,7 +132,7 @@ public function getFileObject()
/**
* @param \TYPO3\CMS\Core\Resource\File $fileObject
*/
public function setFileObject($fileObject)
public function setFileObject($fileObject): void
{
$this->fileObject = $fileObject;
}
Expand All @@ -148,7 +148,7 @@ public function getTitle()
/**
* @param string $title
*/
public function setTitle($title)
public function setTitle($title): void
{
$this->title = $title;
}
Expand All @@ -164,7 +164,7 @@ public function getDescription()
/**
* @param string $description
*/
public function setDescription($description)
public function setDescription($description): void
{
$this->description = $description;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/ImportedEntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ImportedEntityRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
/**
*
*/
public function initializeObject()
public function initializeObject(): void
{
$querySettings = $this->createQuery()->getQuerySettings();
$querySettings->setRespectStoragePage(false);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Service/AbstractSyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
abstract class AbstractSyncService
{

public function run() {
public function run(): void {
$this->fetch();
$this->transform();
$this->store();
Expand Down
11 changes: 5 additions & 6 deletions Classes/Service/DomainObjectTranslationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@
class DomainObjectTranslationService implements SingletonInterface
{
protected \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper $dataMapper;
public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper $dataMapper)
{
$this->dataMapper = $dataMapper;
}

/**
* Translates a domain object
*/
public function translate(DomainObjectInterface $origin, DomainObjectInterface $translation, int $language)
public function translate(DomainObjectInterface $origin, DomainObjectInterface $translation, int $language): void
{
if (get_class($origin) !== get_class($translation)) {
throw new \Exception('Origin and translation must be the same type.', 1432499926);
Expand All @@ -57,9 +61,4 @@ public function translate(DomainObjectInterface $origin, DomainObjectInterface $

$translation->_setProperty('_languageUid', $language);
}

public function injectDataMapper(DataMapper $dataMapper): void
{
$this->dataMapper = $dataMapper;
}
}
12 changes: 4 additions & 8 deletions Classes/Service/Extractor/JsonExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class JsonExtractor extends AbstractExtractor
{

protected $content = NULL;
protected $content;

protected $source;

Expand All @@ -46,7 +46,7 @@ public function getContent()
/**
* @param mixed $content
*/
public function setContent($content)
public function setContent($content): void
{
$this->content = $content;
}
Expand All @@ -62,18 +62,14 @@ public function getSource()
/**
* @param mixed $source
*/
public function setSource($source)
public function setSource($source): void
{
$this->source = $source;
}

function extract()
{
if (is_null($this->content)) {
$rawData = file_get_contents($this->source);
} else {
$rawData = $this->content;
}
$rawData = is_null($this->content) ? file_get_contents($this->source) : $this->content;

$jsonData = json_decode($rawData, true);

Expand Down
4 changes: 2 additions & 2 deletions Classes/Service/Extractor/XmlExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getSource()
/**
* @param mixed $source
*/
public function setSource($source)
public function setSource($source): void
{
$this->source = $source;
}
Expand All @@ -55,7 +55,7 @@ public function extract()
$xmlObject = simplexml_load_string($rawData);

if (!is_object($xmlObject)) {
throw new \Exception('no xml in response');
throw new \Exception('no xml in response', 8369019978);
}

return $xmlObject;
Expand Down
10 changes: 3 additions & 7 deletions Classes/Service/Loader/DatahandlerLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,17 @@ class DatahandlerLoader extends AbstractLoader

public function load($transformedData)
{

foreach ($transformedData as $item) {

}
}

public function process() {
public function process(): void {
/** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
$dataHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\DataHandling\DataHandler');
$dataHandler->start($this->datamap, array());
$dataHandler->process_datamap();

if ($dataHandler->errorLog) {
var_dump($dataHandler->errorLog);
throw new \Exception('error while processing datamap');
throw new \Exception('error while processing datamap', 4318360878);
}

unset($dataHandler);
Expand All @@ -66,7 +62,7 @@ public function process() {
$dataHandler->process_cmdmap();

if ($dataHandler->errorLog) {
throw new \Exception('error while processing cmdmap');
throw new \Exception('error while processing cmdmap', 7879108206);
}

}
Expand Down
4 changes: 1 addition & 3 deletions Classes/Service/Loader/SynchronizedLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ class SynchronizedLoader extends DatahandlerLoader

public function load($transformedData)
{
foreach ($transformedData as $item) {
}
}

protected function sync(DomainObjectInterface $domainObject, $uniqueIdentifier) {
$tables = array_keys($this->datamap);
foreach ($tables as $table) {
foreach ($this->datamap[$table] as $id => $fieldArray) {
foreach ($this->datamap[$table] as $fieldArray) {
if (!is_array($fieldArray)) {
continue;
}
Expand Down
12 changes: 5 additions & 7 deletions Classes/Service/ResourceImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ class ResourceImportService
/**
* Import a single resource, download the file and store it locally
*
* @param \Sinso\Smartimport\Domain\Model\Resource $resource
* @throws EmptyContentException
*/
public function importResource(\Sinso\Smartimport\Domain\Model\Resource $resource)
public function importResource(\Sinso\Smartimport\Domain\Model\Resource $resource): void
{
$resourcePathAndFilename = GeneralUtility::getFileAbsFileName($resource->getFilename());

Expand All @@ -85,7 +84,7 @@ public function importResource(\Sinso\Smartimport\Domain\Model\Resource $resourc
file_put_contents($resourcePathAndFilename, $resource->getSourceData());
}

$fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($resourcePathAndFilename);
$fileObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceFactory::class)->retrieveFileOrFolderObject($resourcePathAndFilename);
$resource->setFileObject($fileObject);
}

Expand All @@ -98,11 +97,10 @@ public function importResource(\Sinso\Smartimport\Domain\Model\Resource $resourc
* TODO: Remove deleted/missing resources from entity
*
* @param array<\Sinso\Smartimport\Domain\Model\Resource> $resources
* @param \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $entity
* @param string $tablename
* @param string $fieldname
*/
public function importResourcesToEntity(Array $resources, \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $entity, $tablename, $fieldname) {
public function importResourcesToEntity(Array $resources, \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $entity, $tablename, $fieldname): void {
$datamap = array();
foreach ($resources as $resource) {
/** @var \Sinso\Smartimport\Domain\Model\Resource $resource */
Expand All @@ -120,7 +118,7 @@ public function importResourcesToEntity(Array $resources, \TYPO3\CMS\Extbase\Dom
);
}

if (!$datamap) {
if ($datamap === []) {
return;
}

Expand Down Expand Up @@ -154,7 +152,7 @@ public function isOverwriteExistingFiles()
/**
* @param boolean $overwriteExistingFiles
*/
public function setOverwriteExistingFiles($overwriteExistingFiles)
public function setOverwriteExistingFiles($overwriteExistingFiles): void
{
$this->overwriteExistingFiles = $overwriteExistingFiles;
}
Expand Down
Loading