This commit is contained in:
Xes
2025-08-14 22:39:38 +02:00
parent 3641e93527
commit 5403f346e3
3370 changed files with 327179 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace XApi\Repository\ORM;
use Doctrine\ORM\EntityRepository;
use XApi\Repository\Doctrine\Mapping\Context;
use XApi\Repository\Doctrine\Mapping\Statement;
use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as BaseStatementRepository;
/**
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
final class StatementRepository extends EntityRepository implements BaseStatementRepository
{
/**
* {@inheritdoc}
*/
public function findStatement(array $criteria)
{
return parent::findOneBy($criteria);
}
/**
* {@inheritdoc}
*/
public function findStatements(array $criteria)
{
if (!empty($criteria['registration'])) {
$contexts = $this->_em->getRepository(Context::class)->findBy([
'registration' => $criteria['registration'],
]);
$criteria['context'] = $contexts;
}
unset(
$criteria['registration'],
$criteria['related_activities'],
$criteria['related_agents'],
$criteria['ascending'],
$criteria['limit']
);
return parent::findBy($criteria, ['created' => 'ASC']);
}
/**
* {@inheritdoc}
*/
public function storeStatement(Statement $mappedStatement, $flush = true)
{
$this->_em->persist($mappedStatement);
if ($flush) {
$this->_em->flush();
}
}
}