Initial Commit
This commit is contained in:
1 parent
4f495177e4
commit
b6d2142214
166 files changed
+13952
-178
No files matched your search
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Evomedien\Vitec\Domain\Repository;
|
||||
|
||||
/**
|
||||
* This file is part of the "VITEC" 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) 2025
|
||||
*/
|
||||
|
||||
/**
|
||||
* The repository for Downloads
|
||||
*/
|
||||
class DownloadRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
||||
{
|
||||
public function findByUids(array $uids)
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
return $query->matching(
|
||||
$query->in('uid', $uids) // Use 'uid' instead of 'uids'
|
||||
)->execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Evomedien\Vitec\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||
|
||||
class MarketRepository extends Repository
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace Evomedien\Vitec\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
|
||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||
|
||||
class ProductRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Find products with visibility filters and optional category filtering
|
||||
*
|
||||
* @param array $categoryUids Optional category UIDs to filter by
|
||||
* @param bool $respectVisibility Whether to apply visibility filters
|
||||
* @return QueryResultInterface
|
||||
*/
|
||||
public function findFilteredProducts(array $categoryUids = [], bool $respectVisibility = true): QueryResultInterface
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
$constraints = [];
|
||||
|
||||
// Add visibility constraints if requested
|
||||
if ($respectVisibility) {
|
||||
$constraints[] = $query->equals('legacy', 0);
|
||||
$constraints[] = $query->equals('supportproduct', 0);
|
||||
$constraints[] = $query->equals('hideonwebsite', 0);
|
||||
$constraints[] = $query->equals('hideonproducts', 0);
|
||||
$constraints[] = $query->equals('subproduct', 0);
|
||||
}
|
||||
|
||||
// Add category filtering if categories are provided
|
||||
$categoryUids = array_filter(array_map('intval', $categoryUids));
|
||||
if (!empty($categoryUids)) {
|
||||
// For TYPO3 13.4, use contains() for MM relations to sys_category
|
||||
$categoryConstraints = [];
|
||||
foreach ($categoryUids as $categoryUid) {
|
||||
$categoryConstraints[] = $query->contains('categories', $categoryUid);
|
||||
}
|
||||
$constraints[] = $query->logicalOr(...$categoryConstraints);
|
||||
}
|
||||
|
||||
// Apply constraints if any exist
|
||||
if (!empty($constraints)) {
|
||||
$query->matching($query->logicalAnd(...$constraints));
|
||||
}
|
||||
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Find all visible products (convenience method)
|
||||
*/
|
||||
public function findAllVisible(): QueryResultInterface
|
||||
{
|
||||
return $this->findFilteredProducts([], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find products by categories only (no visibility filtering)
|
||||
*/
|
||||
public function findByCategoriesOnly(array $categoryUids): QueryResultInterface
|
||||
{
|
||||
return $this->findFilteredProducts($categoryUids, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Evomedien\Vitec\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||
|
||||
class SolutionRepository extends Repository
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace Evomedien\Vitec\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
|
||||
|
||||
|
||||
/**
|
||||
* This file is part of the "VITEC" 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) 2025
|
||||
*/
|
||||
|
||||
/**
|
||||
* The repository for Usecase
|
||||
*/
|
||||
class UsecaseRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
||||
{
|
||||
|
||||
public function findAllWithCategories(): QueryResultInterface
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
$query->getQuerySettings()->setRespectStoragePage(false); // Fetch from all storage pages
|
||||
return $query->execute();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user