Skip to content

Commit

Permalink
fix: remove non-existing field 'table_local' (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
4allportaleabdullah committed Sep 19, 2024
1 parent aace2a1 commit 18e80ec
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Classes/TypeConverter/FileReferenceTypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Crossmedia\Fourallportal\TypeConverter;

use Crossmedia\Fourallportal\Mapping\DeferralException;
use Crossmedia\Fourallportal\Service\LoggingService;
use Doctrine\DBAL\Exception;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Resource\FileRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory;
use TYPO3\CMS\Extbase\Persistence\RepositoryInterface;
use TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException;
use TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException;
Expand All @@ -24,11 +24,11 @@ class FileReferenceTypeConverter extends AbstractUuidAwareObjectTypeConverter im
protected $sourceTypes = [
'string'
];
protected LoggingService|null $dataMapFactory = null;
protected DataMapFactory|null $dataMapFactory = null;

protected FileRepository|null $fileRepository = null;

public function injectLoggingService(LoggingService $dataMapFactory): void
public function injectLoggingService(DataMapFactory $dataMapFactory): void
{
$this->dataMapFactory = $dataMapFactory;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public function convertFrom($source, string $targetType, array $convertedChildPr
$systemLanguageUid
)
)->setMaxResults(1);
$references = $query->execute()->fetchAll();
$references = $query->executeQuery()->fetchAllNumeric();
if (isset($references[0]['uid'])) {
return $this->fetchObjectFromPersistence((int)$references[0]['uid'], $targetType);
}
Expand All @@ -99,8 +99,8 @@ public function convertFrom($source, string $targetType, array $convertedChildPr
$original = $queryBuilder->select('f.uid')->from('sys_file', 'f')
->where($queryBuilder->expr()->eq('f.remote_id', $queryBuilder->quote($source)))
->setMaxResults(1)
->execute()
->fetchAll();
->executeQuery()
->fetchAllNumeric();
if (!isset($original[0]['uid'])) {
$parentObjectId = method_exists($this->parentObject, 'getRemoteId') ? $this->parentObject->getRemoteId() : $this->parentObject->getUid();
throw new DeferralException(
Expand All @@ -115,7 +115,6 @@ public function convertFrom($source, string $targetType, array $convertedChildPr
$referenceProperties = [
//'pid' => $this->parentObject->getPid(),
'tablenames' => $dataMap->getTableName(),
'table_local' => 'sys_file',
'fieldname' => $fieldName,
'uid_local' => $original[0]['uid'],
'uid_foreign' => $this->parentObject->getUid(),
Expand Down

0 comments on commit 18e80ec

Please sign in to comment.