Optimized RequestManagement

This commit is contained in:
Kevin Frantz
2019-01-15 22:57:54 +01:00
parent ee4dc0d052
commit 662541cec2
17 changed files with 161 additions and 76 deletions

View File

@@ -4,15 +4,13 @@ namespace App\Repository\Source;
use Doctrine\ORM\EntityRepository;
use App\Entity\Source\SourceInterface;
use App\Domain\SourceManagement\RequestedSourceInterface;
use App\Domain\RequestManagement\RequestedSourceInterface;
final class SourceRepository extends EntityRepository
/**
* @author kevinfrantz
*/
final class SourceRepository extends EntityRepository implements SourceRepositoryInterface
{
/**
* @param string $slug
*
* @return SourceInterface|null
*/
public function findOneBySlug(string $slug): ?SourceInterface
{
return $this->findOneBy([
@@ -20,13 +18,6 @@ final class SourceRepository extends EntityRepository
]);
}
/**
* Loads a source by id or if not defined, by slug.
*
* @param RequestedSourceInterface $requestedSource
*
* @return SourceInterface|null
*/
public function findOneByIdOrSlug(RequestedSourceInterface $requestedSource): ?SourceInterface
{
if ($requestedSource->hasId()) {

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Repository\Source;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\Common\Collections\Selectable;
use App\Entity\Source\SourceInterface;
use App\Domain\RequestManagement\RequestedSourceInterface;
/**
* @author kevinfrantz
*/
interface SourceRepositoryInterface extends ObjectRepository, Selectable
{
/**
* Finds an Entity by slug.
*
* @param string $slug
*
* @return SourceInterface|null
*/
public function findOneBySlug(string $slug): ?SourceInterface;
/**
* Loads a source by id or if not defined, by slug.
*
* @param RequestedSourceInterface $requestedSource
*
* @return SourceInterface|null
*/
public function findOneByIdOrSlug(RequestedSourceInterface $requestedSource): ?SourceInterface;
}