at the end of the day, it was inevitable

This commit is contained in:
Mo Elzubeir
2022-12-09 08:36:26 -06:00
commit 1218570914
1768 changed files with 887087 additions and 0 deletions
@@ -0,0 +1,39 @@
<?php
namespace CacheBundle\Repository;
use Doctrine\ORM\EntityRepository;
/**
* Class CommonFeedRepository
* @package CacheBundle\Repository
*/
class CommonFeedRepository extends EntityRepository
{
/**
* Get single feed from repository.
*
* @param integer $id A Feed entity instance id.
* @param integer $user Filter feeds by specified owner if set.
*
* @return \CacheBundle\Entity\Feed\AbstractFeed|null
*/
public function getOne($id, $user)
{
$expr = $this->_em->getExpressionBuilder();
$condition = $expr->andX($expr->eq('Feed.id', ':id'));
$parameters = [ 'id' => $id ];
if ($user !== null) {
$condition->add($expr->eq('Feed.user', ':user'));
$parameters['user'] = $user;
}
return $this->createQueryBuilder('Feed')
->where($condition)
->setParameters($parameters)
->getQuery()
->getOneOrNullResult();
}
}