93 search results for andWhere

75 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 16
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 19 - 37
/**
* @return Article[]
*/
public function findAllPublishedLastWeekByAuthor(User $author): array
{
return $this->createQueryBuilder('a')
->andWhere('a.author = :author')
->andWhere('a.publishedAt > :week_ago')
->setParameter('author', $author)
->setParameter('week_ago', new \DateTime('-1 week'))
->getQuery()
->getResult();
}
// ... lines 51 - 73
}
See Code Block in Script
// ... lines 1 - 8
class GenusNoteRepository extends EntityRepository
{
// ... lines 11 - 14
public function findAllRecentNotesForGenus(Genus $genus)
{
return $this->createQueryBuilder('genus_note')
->andWhere('genus_note.genus = :genus')
->setParameter('genus', $genus)
->andWhere('genus_note.createdAt > :recentDate')
->setParameter('recentDate', new \DateTime('-3 months'))
// ... line 22
->getQuery()
->execute();
}
}
See Code Block in Script
51 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 14
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 17 - 21
// /**
// * @return Article[] Returns an array of Article objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->orderBy('a.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Article
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
See Code Block in Script
62 lines | src/Repository/VoyageRepository.php
// ... lines 1 - 17
class VoyageRepository extends ServiceEntityRepository
{
// ... lines 20 - 40
public function findBySearchQueryBuilder(?string $query, array $searchPlanets, ?string $sort = null, string $direction = 'DESC'): QueryBuilder
{
$qb = $this->createQueryBuilder('v');
if ($query) {
$qb->andWhere('v.purpose LIKE :query')
->setParameter('query', '%' . $query . '%');
}
if ($searchPlanets) {
$qb->andWhere('v.planet IN (:planets)')
->setParameter('planets', $searchPlanets);
}
if ($sort) {
$qb->orderBy('v.' . $sort, $direction);
}
return $qb;
}
}
See Code Block in Script
// ... lines 1 - 12
class DragonTreasureIsPublishedExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface
{
// ... lines 15 - 33
private function addIsPublishedWhere(string $resourceClass, QueryBuilder $queryBuilder): void
{
if (DragonTreasure::class !== $resourceClass) {
return;
}
$rootAlias = $queryBuilder->getRootAliases()[0];
$user = $this->security->getUser();
if ($user) {
$queryBuilder->andWhere(sprintf('%s.isPublished = :isPublished OR %s.owner = :owner', $rootAlias, $rootAlias))
->setParameter('owner', $user);
} else {
$queryBuilder->andWhere(sprintf('%s.isPublished = :isPublished', $rootAlias));
}
$queryBuilder->setParameter('isPublished', true);
}
}
See Code Block in Script
// ... lines 1 - 14
return $this->createQueryBuilder('genus')
->andWhere('genus.isPublished = :isPublished')
// ... lines 17 - 23
See Code Block in Script
// ... lines 1 - 14
return $this->createQueryBuilder('genus')
->andWhere('genus.isPublished = :isPublished')
->setParameter('isPublished', true)
// ... lines 18 - 23
See Code Block in Script
// ... lines 1 - 14
public function countNumberPrintedForCategory(Category $category)
{
return $this->createQueryBuilder('fc')
->andWhere('fc.category = :category')
->setParameter('category', $category)
// ... lines 20 - 22
}
// ... lines 24 - 26
See Code Block in Script
// ... lines 1 - 23
public function search($term)
{
return $this->createQueryBuilder('cat')
->andWhere('cat.name = :searchTerm')
->setParameter('searchTerm', $term)
->getQuery()
->execute();
}
// ... lines 32 - 33
See Code Block in Script
54 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 15
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 18 - 48
private function addIsPublishedQueryBuilder(QueryBuilder $qb)
{
return $qb->andWhere('a.publishedAt IS NOT NULL');
}
}
See Code Block in Script
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')
// ... lines 29 - 31
;
}
// ... 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')
// ... lines 29 - 33
;
}
// ... lines 36 - 47
}
See Code Block in Script
// ... lines 1 - 14
return $this->createQueryBuilder('genus')
->andWhere('genus.isPublished = :isPublished')
->setParameter('isPublished', true)
->orderBy('genus.speciesCount', 'DESC')
->getQuery()
->execute();
// ... lines 21 - 23
See Code Block in Script
// ... lines 1 - 14
return $this->createQueryBuilder('genus')
->andWhere('genus.isPublished = :isPublished')
->setParameter('isPublished', true)
->orderBy('genus.speciesCount', 'DESC')
// ... lines 19 - 23
See Code Block in Script
103 lines | src/Entity/Category.php
// ... lines 1 - 64
public function getFortuneCookiesStillInProduction(): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('discontinued', false));
// ... lines 69 - 70
}
// ... lines 72 - 103
See Code Block in Script
80 lines | src/Repository/FortuneCookieRepository.php
// ... lines 1 - 24
public function countNumberPrintedForCategory(Category $category): int
{
$result = $this->createQueryBuilder('fortuneCookie')
// ... line 28
->andWhere('fortuneCookie.category = :category')
->setParameter('category', $category)
// ... lines 31 - 34
}
// ... lines 36 - 80
See Code Block in Script
93 lines | src/Repository/CategoryRepository.php
// ... lines 1 - 40
public function search(string $term): array
{
return $this->createQueryBuilder('category')
->andWhere('category.name = :searchTerm')
->setParameter('searchTerm', $term)
// ... lines 46 - 47
}
// ... lines 49 - 93
See Code Block in Script
71 lines | src/Repository/VinylMixRepository.php
// ... lines 1 - 44
public function findAllOrderedByVotes(string $genre = null): array
{
// ... lines 47 - 49
if ($genre) {
$queryBuilder->andWhere('mix.genre = :genre')
->setParameter('genre', $genre);
}
// ... lines 54 - 58
}
// ... lines 60 - 71
See Code Block in Script
58 lines | src/Repository/QuestionRepository.php
// ... lines 1 - 15
class QuestionRepository extends ServiceEntityRepository
{
// ... lines 18 - 34
private function addIsAskedQueryBuilder(QueryBuilder $qb = null): QueryBuilder
{
return $this->getOrCreateQueryBuilder($qb)
->andWhere('q.askedAt IS NOT NULL');
}
// ... lines 40 - 56
}
See Code Block in Script
54 lines | src/Repository/QuestionRepository.php
// ... lines 1 - 15
class QuestionRepository extends ServiceEntityRepository
{
// ... lines 18 - 36
private function addIsAskedQueryBuilder(QueryBuilder $qb): QueryBuilder
{
return $qb->andWhere('q.askedAt IS NOT NULL');
}
// ... lines 41 - 52
}
See Code Block in Script