src/RepositoryTrait.php
public function findByOrFail(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
    {
        $objects = $this->findBy($criteria, $orderBy, $limit, $offset);

        if (\count($objects) === 0) {
            throw new FindException('FindBy did not return any results');
        }

        return $objects;
    }
public function findByOrFail(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
    {
        $objects = $this->findBy($criteria, $orderBy, $limit, $offset);

        if (\count($objects) === 0) {
            throw new FindException('FindBy did not return any results');
        }

        return $objects;
    }
Find elements or throw an exception if none found.

@param array      $criteria
@param array|null $orderBy
@param int|null   $limit
@param int|null   $offset

@throws FindException

@return object[]