initial commit
This commit is contained in:
50
Classes/Domain/Repository/MapEntryRepository.php
Normal file
50
Classes/Domain/Repository/MapEntryRepository.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gTravelBlog\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
|
||||
/**
|
||||
* 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
|
||||
// ];
|
||||
|
||||
static protected function mapInt($value){
|
||||
if(MathUtility::canBeInterpretedAsInteger($value)){
|
||||
return (int)$value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFromCategoryUids(array $uids){
|
||||
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
|
||||
$query = $this->createQuery();
|
||||
$query->matching(
|
||||
$query->logicalOr($query->in('relTravelPost.categories.uid', $uidsFiltered)));
|
||||
return $query->execute();
|
||||
|
||||
}
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
}
|
49
Classes/Domain/Repository/TravelAuthorRepository.php
Normal file
49
Classes/Domain/Repository/TravelAuthorRepository.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gTravelBlog\Domain\Repository;
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
|
||||
/**
|
||||
* This file is part of the "Travel Blog" 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 TravelAuthor
|
||||
*/
|
||||
class TravelAuthorRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
// protected $defaultOrderings = [
|
||||
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
|
||||
// ];
|
||||
|
||||
static protected function mapInt($value){
|
||||
if(MathUtility::canBeInterpretedAsInteger($value)){
|
||||
return (int)$value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFromUids(array $uids){
|
||||
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
|
||||
$query = $this->createQuery();
|
||||
$query->matching(
|
||||
$query->logicalOr($query->in('uid', $uidsFiltered)));
|
||||
return $query->execute();
|
||||
|
||||
}
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
}
|
42
Classes/Domain/Repository/TravelCategoryRepository.php
Normal file
42
Classes/Domain/Repository/TravelCategoryRepository.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gTravelBlog\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
|
||||
/**
|
||||
* 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 TravelPost
|
||||
*/
|
||||
class TravelCategoryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
// protected $defaultOrderings = [
|
||||
// 'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
|
||||
// ];
|
||||
//
|
||||
static protected function mapInt($value){
|
||||
if(MathUtility::canBeInterpretedAsInteger($value)){
|
||||
return (int)$value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
}
|
61
Classes/Domain/Repository/TravelPostRepository.php
Normal file
61
Classes/Domain/Repository/TravelPostRepository.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace A2G\A2gTravelBlog\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
|
||||
/**
|
||||
* 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 TravelPost
|
||||
*/
|
||||
class TravelPostRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $defaultOrderings = [
|
||||
'crdate' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING
|
||||
];
|
||||
|
||||
static protected function mapInt($value){
|
||||
if(MathUtility::canBeInterpretedAsInteger($value)){
|
||||
return (int)$value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFromCategoryUids(array $uids){
|
||||
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
|
||||
$query = $this->createQuery();
|
||||
$query->matching($query->in('categories.uid', $uidsFiltered));
|
||||
return $query->execute();
|
||||
}
|
||||
public function getFromAuthorUids(array $uids){
|
||||
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
|
||||
$query = $this->createQuery();
|
||||
$query->matching($query->in('authors.uid', $uidsFiltered));
|
||||
return $query->execute();
|
||||
}
|
||||
public function getFromTagUids(array $uids){
|
||||
$uidsFiltered = array_filter(array_map('self::mapInt', $uids));
|
||||
$query = $this->createQuery();
|
||||
$query->matching($query->in('tags.uid', $uidsFiltered));
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
public function initializeObject() {
|
||||
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user