|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Repository; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\ConferenceRecording; |
|
10
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
|
11
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Repository for the ConferenceRecording entity. |
|
15
|
|
|
*/ |
|
16
|
|
|
class ConferenceRecordingRepository extends ServiceEntityRepository |
|
17
|
|
|
{ |
|
18
|
|
|
public function __construct(ManagerRegistry $registry) |
|
19
|
|
|
{ |
|
20
|
|
|
parent::__construct($registry, ConferenceRecording::class); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Find recordings by meetingId (remoteId). |
|
25
|
|
|
*/ |
|
26
|
|
|
public function findByMeetingId(string $meetingId): array |
|
27
|
|
|
{ |
|
28
|
|
|
return $this->createQueryBuilder('r') |
|
29
|
|
|
->where('r.meetingId = :meetingId') |
|
30
|
|
|
->setParameter('meetingId', $meetingId) |
|
31
|
|
|
->getQuery() |
|
32
|
|
|
->getArrayResult(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Delete all recordings by meetingId. |
|
37
|
|
|
*/ |
|
38
|
|
|
public function deleteByMeetingId(string $meetingId): void |
|
39
|
|
|
{ |
|
40
|
|
|
$qb = $this->_em->createQueryBuilder(); |
|
41
|
|
|
|
|
42
|
|
|
$qb |
|
43
|
|
|
->delete('Chamilo\CoreBundle\Entity\ConferenceRecording', 'r') |
|
44
|
|
|
->where('r.meetingId = :meetingId') |
|
45
|
|
|
->setParameter('meetingId', $meetingId) |
|
46
|
|
|
->getQuery() |
|
47
|
|
|
->execute(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Find a recording by recordId. |
|
52
|
|
|
*/ |
|
53
|
|
|
public function findByRecordId(string $recordId): ?array |
|
54
|
|
|
{ |
|
55
|
|
|
$result = $this->createQueryBuilder('r') |
|
56
|
|
|
->where('r.recordId = :recordId') |
|
57
|
|
|
->setParameter('recordId', $recordId) |
|
58
|
|
|
->getQuery() |
|
59
|
|
|
->getArrayResult(); |
|
60
|
|
|
|
|
61
|
|
|
return $result[0] ?? null; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function findByMeetingRemoteId(string $remoteId): array |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->createQueryBuilder('r') |
|
67
|
|
|
->join('r.meeting', 'm') |
|
68
|
|
|
->where('m.remoteId = :remoteId') |
|
69
|
|
|
->setParameter('remoteId', $remoteId) |
|
70
|
|
|
->getQuery() |
|
71
|
|
|
->getArrayResult(); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|