93 search results for andWhere

47 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 14
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 17 - 24
public function findAllPublishedOrderedByNewest()
{
return $this->createQueryBuilder('a')
->andWhere('a.publishedAt IS NOT NULL')
->orderBy('a.publishedAt', 'DESC')
->getQuery()
->getResult()
;
}
// ... lines 34 - 45
}
See Code Block in Script
49 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 14
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 17 - 24
public function findAllPublishedOrderedByNewest()
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->orderBy('a.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
// ... lines 36 - 47
}
See Code Block in Script
// ... lines 1 - 5
use AppBundle\Entity\User;
// ... lines 7 - 8
class ProgrammerRepository extends EntityRepository
{
// ... lines 11 - 19
public function createQueryBuilderForUser(User $user)
{
return $this->createQueryBuilder('programmer')
->andWhere('programmer.user = :user')
->setParameter('user', $user);
}
// ... lines 26 - 46
}
See Code Block in Script
// ... lines 1 - 8
class ProgrammerRepository extends EntityRepository
{
// ... lines 11 - 28
public function findAllQueryBuilder($filter = '')
{
$qb = $this->createQueryBuilder('programmer');
if ($filter) {
$qb->andWhere('programmer.nickname LIKE :filter OR programmer.tagLine LIKE :filter')
->setParameter('filter', '%'.$filter.'%');
}
return $qb;
}
}
See Code Block in Script
35 lines | src/Repository/LockDownRepository.php
// ... lines 1 - 17
class LockDownRepository extends ServiceEntityRepository
{
// ... lines 20 - 24
public function isInLockDown(): bool
{
return $this->createQueryBuilder('lock_down')
->andWhere('lock_down.status != :endedStatus')
->setParameter('endedStatus', LockDownStatus::ENDED)
->setMaxResults(1)
->getQuery()
->getOneOrNullResult() !== null;
}
}
See Code Block in Script
102 lines | src/Repository/FortuneCookieRepository.php
// ... lines 1 - 8
use Doctrine\Common\Collections\Criteria;
// ... lines 10 - 19
class FortuneCookieRepository extends ServiceEntityRepository
{
// ... lines 22 - 26
public static function createFortuneCookiesStillInProductionCriteria(): Criteria
{
return Criteria::create()
->andWhere(Criteria::expr()->eq('discontinued', false));
}
// ... lines 32 - 100
}
See Code Block in Script
115 lines | src/Repository/CategoryRepository.php
// ... lines 1 - 53
public function findWithFortunesJoin(int $id): ?Category
{
$qb = $this->createQueryBuilder('category');
return $this->addFortuneCookieJoinAndSelect($qb)
->andWhere('category.id = :id')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult();
}
// ... lines 64 - 115
See Code Block in Script
80 lines | src/Repository/FortuneCookieRepository.php
// ... lines 1 - 24
public function countNumberPrintedForCategory(Category $category): int
{
$result = $this->createQueryBuilder('fortuneCookie')
->select('SUM(fortuneCookie.numberPrinted) AS fortunesPrinted')
->andWhere('fortuneCookie.category = :category')
->setParameter('category', $category)
->getQuery()
->getOneOrNullResult();
return $result;
}
// ... lines 36 - 80
See Code Block in Script
107 lines | src/Repository/CategoryRepository.php
// ... lines 1 - 17
class CategoryRepository extends ServiceEntityRepository
{
// ... lines 20 - 52
public function findWithFortunesJoin(int $id): ?Category
{
return $this->createQueryBuilder('category')
// ... lines 56 - 57
->andWhere('category.id = :id')
->setParameter('id', $id)
->getQuery()
// ... line 61
}
// ... lines 63 - 105
}
See Code Block in Script
95 lines | src/Repository/CategoryRepository.php
// ... lines 1 - 40
public function search(string $term): array
{
return $this->createQueryBuilder('category')
// ... line 44
->andWhere('category.name LIKE :searchTerm OR category.iconKey LIKE :searchTerm OR fortuneCookie.fortune LIKE :searchTerm')
// ... lines 46 - 49
}
// ... lines 51 - 95
See Code Block in Script
// ... lines 1 - 35
public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
{
// ... lines 38 - 43
$queryBuilder
->andWhere('entity.id = :id')
->setParameter('id', $this->getUser()->getId());
return $queryBuilder;
}
// ... lines 50 - 85
See Code Block in Script
// ... lines 1 - 12
class QuestionCrudController extends AbstractCrudController
{
// ... lines 15 - 19
public function configureFields(string $pageName): iterable
{
// ... lines 22 - 29
yield AssociationField::new('askedBy')
// ... lines 31 - 38
->setQueryBuilder(function (QueryBuilder $qb) {
$qb->andWhere('entity.enabled = :enabled')
->setParameter('enabled', true);
});
// ... lines 43 - 44
}
}
See Code Block in Script
38 lines | src/ApiPlatform/CheeseSearchFilter.php
// ... lines 1 - 8
class CheeseSearchFilter extends AbstractFilter
{
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null)
{
// ... lines 13 - 19
$queryBuilder->andWhere(sprintf('%s.title LIKE :%s OR %s.description LIKE :%s', $alias, $valueParameter, $alias, $valueParameter))
->setParameter($valueParameter, '%'.$value.'%');
}
// ... lines 23 - 36
}
See Code Block in Script
36 lines | src/ApiPlatform/CheeseSearchFilter.php
// ... lines 1 - 8
class CheeseSearchFilter extends AbstractFilter
{
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null)
{
// ... lines 13 - 17
$queryBuilder->andWhere(sprintf('%s.title LIKE :search OR %s.description LIKE :search', $alias, $alias))
->setParameter('search', '%'.$value.'%');
}
// ... lines 21 - 34
}
See Code Block in Script
36 lines | src/ApiPlatform/CheeseSearchFilter.php
// ... lines 1 - 8
class CheeseSearchFilter extends AbstractFilter
{
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null)
{
// ... lines 13 - 17
$queryBuilder->andWhere(sprintf('%s.title LIKE :search OR %s.description LIKE :search', $alias, $alias))
->setParameter('search', '%'.$value.'%');
}
// ... lines 21 - 34
}
See Code Block in Script
36 lines | src/ApiPlatform/CheeseSearchFilter.php
// ... lines 1 - 8
class CheeseSearchFilter extends AbstractFilter
{
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null)
{
// ... lines 13 - 16
$alias = $queryBuilder->getRootAliases()[0];
$queryBuilder->andWhere(sprintf('%s.title LIKE :search OR %s.description LIKE :search', $alias, $alias))
->setParameter('search', '%'.$value.'%');
}
// ... lines 21 - 34
}
See Code Block in Script
36 lines | src/ApiPlatform/CheeseSearchFilter.php
// ... lines 1 - 8
class CheeseSearchFilter extends AbstractFilter
{
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null)
{
// ... lines 13 - 16
$alias = $queryBuilder->getRootAliases()[0];
$queryBuilder->andWhere(sprintf('%s.title LIKE :search OR %s.description LIKE :search', $alias, $alias))
// ... line 19
}
// ... lines 21 - 34
}
See Code Block in Script
81 lines | src/Repository/CommentRepository.php
// ... lines 1 - 15
class CommentRepository extends ServiceEntityRepository
{
// ... lines 18 - 30
/**
* @param string|null $term
* @return Comment[]
*/
public function findAllWithSearch(?string $term)
{
$qb = $this->createQueryBuilder('c');
if ($term) {
$qb->andWhere('c.content LIKE :term OR c.authorName LIKE :term')
->setParameter('term', '%' . $term . '%')
;
}
return $qb
->orderBy('c.createdAt', 'DESC')
->getQuery()
->getResult()
;
}
// ... lines 51 - 79
}
See Code Block in Script
81 lines | src/Repository/CommentRepository.php
// ... lines 1 - 15
class CommentRepository extends ServiceEntityRepository
{
// ... lines 18 - 30
/**
* @param string|null $term
* @return Comment[]
*/
public function findAllWithSearch(?string $term)
{
$qb = $this->createQueryBuilder('c');
if ($term) {
$qb->andWhere('c.content LIKE :term OR c.authorName LIKE :term')
->setParameter('term', '%' . $term . '%')
;
}
// ... lines 44 - 49
}
// ... lines 51 - 79
}
See Code Block in Script
// ... lines 1 - 7
class GenusRepository extends EntityRepository
{
// ... lines 10 - 12
public function findAllPublishedOrderedByRecentlyActive()
{
return $this->createQueryBuilder('genus')
->andWhere('genus.isPublished = :isPublished')
->setParameter('isPublished', true)
->leftJoin('genus.notes', 'genus_note')
->orderBy('genus_note.createdAt', 'DESC')
// ->leftJoin('genus.genusScientists', 'genusScientist')
// ->addSelect('genusScientist')
->getQuery()
->execute();
}
}
See Code Block in Script