mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 05:47:11 +02:00
Optimized findOneByIdOrSlug function
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user