|
|
|
@ -7,6 +7,7 @@ use App\Entity\User;
@@ -7,6 +7,7 @@ use App\Entity\User;
|
|
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
|
|
|
use Doctrine\ORM\Query; |
|
|
|
|
use Symfony\Bridge\Doctrine\RegistryInterface; |
|
|
|
|
use Symfony\Bundle\MakerBundle\Str; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @method Streams|null find($id, $lockMode = null, $lockVersion = null) |
|
|
|
@ -55,4 +56,32 @@ class StreamsRepository extends ServiceEntityRepository
@@ -55,4 +56,32 @@ class StreamsRepository extends ServiceEntityRepository
|
|
|
|
|
|
|
|
|
|
return $qb->getResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param string $streamName |
|
|
|
|
* @param string $userName |
|
|
|
|
* @param string $streamKey |
|
|
|
|
* @return Streams |
|
|
|
|
* @author Soner Sayakci <shyim@posteo.de> |
|
|
|
|
*/ |
|
|
|
|
public function getStreamByNameAndUsername(string $streamName, string $userName, string $streamKey): ?Streams |
|
|
|
|
{ |
|
|
|
|
$qb = $this->createQueryBuilder('streams') |
|
|
|
|
->addSelect('endpoints') |
|
|
|
|
->addSelect('user') |
|
|
|
|
->leftJoin('streams.endpoints', 'endpoints') |
|
|
|
|
->innerJoin('streams.user', 'user') |
|
|
|
|
->andWhere('streams.active = true') |
|
|
|
|
->andWhere('endpoints.active = true') |
|
|
|
|
->andWhere('streams.name = :streamName') |
|
|
|
|
->andWhere('user.username = :userName') |
|
|
|
|
->andWhere('streams.streamKey = :streamKey') |
|
|
|
|
->setParameter('streamName', $streamName) |
|
|
|
|
->setParameter('streamKey', $streamKey) |
|
|
|
|
->setParameter('userName', $userName) |
|
|
|
|
->getQuery(); |
|
|
|
|
|
|
|
|
|
$qb->setMaxResults(1); |
|
|
|
|
return $qb->getResult()[0]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|