feat: stores user's media preferences

This commit is contained in:
2025-04-29 16:17:40 -05:00
parent 0225bead60
commit c3eaf109e3
15 changed files with 429 additions and 31 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\User\Framework\Repository;
use App\User\Framework\Entity\UserPreference;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<UserPreference>
*/
class UserPreferenceRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, UserPreference::class);
}
public function findUserPreferences(int $userId): array
{
return $this->findBy(['userId' => $userId]);
}
public function findUserResolution(int $userId): ?UserPreference
{
return $this->findOneBy(['userId' => $userId, 'preference' => 'resolution']);
}
public function findUserCodec(int $userId): ?UserPreference
{
return $this->findOneBy(['userId' => $userId, 'preference' => 'codec']);
}
public function findUserLanguage(int $userId): ?UserPreference
{
return $this->findOneBy(['userId' => $userId, 'preference' => 'language']);
}
public function findUserProvider(int $userId): ?UserPreference
{
return $this->findOneBy(['userId' => $userId, 'preference' => 'resolution']);
}
}