initial commit
This commit is contained in:
79
Classes/Domain/Repository/MapEntryRepository.php
Executable file
79
Classes/Domain/Repository/MapEntryRepository.php
Executable file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gMaps\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
||||
|
||||
/**
|
||||
* This file is part of the "Products" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
|
||||
*/
|
||||
|
||||
/**
|
||||
* The repository for MapEntry
|
||||
*/
|
||||
class MapEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
// protected $defaultOrderings = [
|
||||
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
|
||||
// ];
|
||||
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
|
||||
static private function mapInt($value){
|
||||
if(MathUtility::canBeInterpretedAsInteger($value)){
|
||||
return (int)$value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getFromUids(array $uids, ?string $orderBy = null){
|
||||
$arguments = [];
|
||||
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
|
||||
if(count($uidsFiltered) === 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
$query = $this->createQuery();
|
||||
$sql = 'SELECT meT.* FROM tx_a2gmaps_domain_model_mapentry AS meT ';
|
||||
$sqlWhere = 'WHERE meT.hidden=0 AND meT.deleted=0 AND meT.uid IN ('.implode(',', $uidsFiltered).')';
|
||||
|
||||
$query->statement($sql . $sqlWhere, $arguments);
|
||||
|
||||
|
||||
return $query->execute();
|
||||
|
||||
}
|
||||
|
||||
public function getEntriesFromMap(int $ttContentUid){
|
||||
$query = $this->createQuery();
|
||||
$sql = 'SELECT tcT.* FROM tt_content AS tcT ';
|
||||
$sqlWhere = 'WHERE tcT.hidden=0 AND tcT.deleted=0 AND tcT.uid = :dcUid ';
|
||||
|
||||
$arguments = [
|
||||
':dcUid' => $ttContentUid
|
||||
];
|
||||
$query->statement($sql . $sqlWhere, $arguments);
|
||||
|
||||
|
||||
return explode(',',GeneralUtility::xml2array($query->execute(1)[0]['pi_flexform'])['data']['sDEF']['lDEF']['settings.markers']['vDEF']);
|
||||
}
|
||||
|
||||
}
|
37
Classes/Domain/Repository/MarkerRepository.php
Executable file
37
Classes/Domain/Repository/MarkerRepository.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gMaps\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* This file is part of the "Products" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
|
||||
*/
|
||||
|
||||
/**
|
||||
* The repository for Marker
|
||||
*/
|
||||
class MarkerRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
// protected $defaultOrderings = [
|
||||
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
|
||||
// ];
|
||||
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
|
||||
}
|
46
Classes/Domain/Repository/SysFileReferenceRepository.php
Executable file
46
Classes/Domain/Repository/SysFileReferenceRepository.php
Executable file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gMaps\Domain\Repository;
|
||||
|
||||
/**
|
||||
* This file is part of the "Products" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2021 Raphael Martin <raphy.martin@gmail.com>, none
|
||||
*/
|
||||
|
||||
/**
|
||||
* The repository for SysFileReference
|
||||
*/
|
||||
class SysFileReferenceRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
// protected $defaultOrderings = [
|
||||
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
|
||||
// ];
|
||||
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
|
||||
public function findByTablename(string $tableName, int $uid){
|
||||
$query = $this->createQuery();
|
||||
$sql = 'SELECT sfrT.* FROM sys_file_reference AS sfrT ';
|
||||
$sqlWhere = 'WHERE sfrT.hidden=0 AND sfrT.deleted=0 AND sfrT.tablenames = :dcTablename AND sfrT.uid_foreign = :dcUid ';
|
||||
|
||||
$arguments = [
|
||||
':dcTablename' => $tableName,
|
||||
':dcUid' => $uid
|
||||
];
|
||||
$query->statement($sql . $sqlWhere, $arguments);
|
||||
return $query->execute();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user