mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00: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