93 search results for andWhere

224 lines | src/AppBundle/Entity/Genus.php
// ... lines 1 - 5
use Doctrine\Common\Collections\Criteria;
// ... lines 7 - 15
class Genus
{
// ... lines 18 - 214
public function getExpertScientists()
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->gt('yearsStudied', 20))
->orderBy(['yearsStudied' => 'DESC']);
return $this->getGenusScientists()->matching($criteria);
}
}
See Code Block in Script
224 lines | src/AppBundle/Entity/Genus.php
// ... lines 1 - 5
use Doctrine\Common\Collections\Criteria;
// ... lines 7 - 15
class Genus
{
// ... lines 18 - 214
public function getExpertScientists()
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->gt('yearsStudied', 20))
->orderBy(['yearsStudied' => 'DESC']);
// ... lines 220 - 221
}
}
See Code Block in Script
47 lines | src/Repository/QuestionRepository.php
// ... lines 1 - 14
class QuestionRepository extends ServiceEntityRepository
{
// ... lines 17 - 24
public function findAllAskedOrderedByNewest()
{
return $this->createQueryBuilder('q')
->andWhere('q.askedAt IS NOT NULL')
->orderBy('q.askedAt', 'DESC')
->getQuery()
->getResult()
;
}
// ... lines 34 - 45
}
See Code Block in Script
// ... lines 1 - 11
public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null)
{
// ... lines 14 - 17
$rootAlias = $queryBuilder->getRootAliases()[0];
$queryBuilder->andWhere(sprintf('%s.isPublished = :isPublished', $rootAlias))
->setParameter('isPublished', true);
}
See Code Block in Script
67 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 16
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 19 - 35
public static function createNonDeletedCriteria(): Criteria
{
return Criteria::create()
->andWhere(Criteria::expr()->eq('isDeleted', false))
->orderBy(['createdAt' => 'DESC'])
;
}
// ... lines 43 - 65
}
See Code Block in Script
217 lines | src/Entity/Article.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 14
class Article
{
// ... lines 17 - 183
public function getNonDeletedComments(): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('isDeleted', false))
->orderBy(['createdAt' => 'DESC'])
;
return $this->comments->matching($criteria);
}
// ... lines 193 - 215
}
See Code Block in Script
217 lines | src/Entity/Article.php
// ... lines 1 - 6
use Doctrine\Common\Collections\Criteria;
// ... lines 8 - 14
class Article
{
// ... lines 17 - 183
public function getNonDeletedComments(): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('isDeleted', false))
->orderBy(['createdAt' => 'DESC'])
;
// ... lines 190 - 191
}
// ... lines 193 - 215
}
See Code Block in Script
// ... lines 1 - 2
namespace AppBundle\Repository;
use Doctrine\ORM\EntityRepository;
class UserRepository extends EntityRepository
{
public function createIsScientistQueryBuilder()
{
return $this->createQueryBuilder('user')
->andWhere('user.isScientist = :isScientist')
->setParameter('isScientist', true);
}
}
See Code Block in Script
// ... lines 1 - 14
public function countNumberPrintedForCategory(Category $category)
{
return $this->createQueryBuilder('fc')
->andWhere('fc.category = :category')
->setParameter('category', $category)
->select('SUM(fc.numberPrinted) as fortunesPrinted')
->getQuery()
->getSingleScalarResult();
}
// ... lines 24 - 26
See Code Block in Script
// ... lines 1 - 14
public function countNumberPrintedForCategory(Category $category)
{
return $this->createQueryBuilder('fc')
->andWhere('fc.category = :category')
->setParameter('category', $category)
->select('SUM(fc.numberPrinted) as fortunesPrinted')
->getQuery()
->getOneOrNullResult();
}
// ... lines 24 - 26
See Code Block in Script
// ... lines 1 - 14
public function countNumberPrintedForCategory(Category $category)
{
return $this->createQueryBuilder('fc')
->andWhere('fc.category = :category')
->setParameter('category', $category)
->select('SUM(fc.numberPrinted) as fortunesPrinted, AVG(fc.numberPrinted) as fortunesAverage, cat.name')
->getQuery()
->getSingleScalarResult();
}
// ... lines 24 - 26
See Code Block in Script
// ... lines 1 - 39
public function findWithFortunesJoin($id)
{
$qb = $this->createQueryBuilder('cat')
->andWhere('cat.id = :id');
$this->addFortuneCookieJoinAndSelect($qb);
return $qb
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult();
}
// ... lines 52 - 66
See Code Block in Script
// ... lines 1 - 23
public function search($term)
{
return $this->createQueryBuilder('cat')
->andWhere('cat.name LIKE :searchTerm
OR cat.iconKey LIKE :searchTerm
OR fc.fortune LIKE :searchTerm')
->leftJoin('cat.fortuneCookies', 'fc')
->setParameter('searchTerm', '%'.$term.'%')
->getQuery()
->execute();
}
// ... lines 35 - 36
See Code Block in Script
// ... lines 1 - 12
class CategoryRepository extends EntityRepository
{
// ... lines 15 - 38
public function findWithFortunesJoin($id)
{
return $this->createQueryBuilder('cat')
->andWhere('cat.id = :id')
->leftJoin('cat.fortuneCookies', 'fc')
->addSelect('fc')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult();
}
}
See Code Block in Script
// ... lines 1 - 23
public function search($term)
{
return $this->createQueryBuilder('cat')
->andWhere('cat.name LIKE :searchTerm OR cat.iconKey LIKE :searchTerm')
->setParameter('searchTerm', '%'.$term.'%')
->getQuery()
->execute();
}
// ... lines 32 - 33
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)
// ... lines 20 - 22
->getQuery()
->execute();
}
}
See Code Block in Script
47 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 14
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 17 - 21
/**
* @return Article[]
*/
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
// ... 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')
->getQuery()
->execute();
}
}
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')
// ... line 19
->getQuery()
->execute();
}
}
See Code Block in Script
47 lines | src/Repository/ArticleRepository.php
// ... lines 1 - 14
class ArticleRepository extends ServiceEntityRepository
{
// ... lines 17 - 34
/*
public function findOneBySomeField($value): ?Article
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}
See Code Block in Script