]> git.immae.eu Git - github/wallabag/wallabag.git/blame_incremental - src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
Add a live test for restricted article
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / SiteCredentialRepository.php
... / ...
CommitLineData
1<?php
2
3namespace Wallabag\CoreBundle\Repository;
4
5/**
6 * SiteCredentialRepository.
7 */
8class SiteCredentialRepository extends \Doctrine\ORM\EntityRepository
9{
10 /**
11 * Retrieve one username/password for the given host and userId.
12 *
13 * @param string $host
14 * @param int $userId
15 *
16 * @return null|array
17 */
18 public function findOneByHostAndUser($host, $userId)
19 {
20 return $this->createQueryBuilder('s')
21 ->select('s.username', 's.password')
22 ->where('s.host = :hostname')->setParameter('hostname', $host)
23 ->andWhere('s.user = :userId')->setParameter('userId', $userId)
24 ->setMaxResults(1)
25 ->getQuery()
26 ->getOneOrNullResult();
27 }
28}