mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Optimized findOneByIdOrSlug function
This commit is contained in:
parent
bea27399b7
commit
ff95e23859
@ -29,10 +29,10 @@ final class SourceRepository extends EntityRepository
|
||||
*/
|
||||
public function findOneByIdOrSlug(RequestedSourceInterface $requestedSource): ?SourceInterface
|
||||
{
|
||||
try {
|
||||
if ($requestedSource->hasId()) {
|
||||
return $this->find($requestedSource->getId());
|
||||
} catch (\Error $error) {
|
||||
return $this->findOneBySlug($requestedSource->getSlug());
|
||||
}
|
||||
|
||||
return $this->findOneBySlug($requestedSource->getSlug());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user