Skip to content

Commit

Permalink
fix(doctrine): delete select('a')
Browse files Browse the repository at this point in the history
  • Loading branch information
koromerzhin committed Oct 19, 2021
1 parent 1d2e8e7 commit d78860e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 55 deletions.
46 changes: 12 additions & 34 deletions apps/src/Repository/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,28 @@ public function findAllParentForAdmin(array $get): QueryBuilder

public function findByBookmark()
{
$entityManager = $this->getEntityManager();
$dql = $entityManager->createQueryBuilder();
$dql->select('a');
$dql->from(Category::class, 'a');
$dql->leftJoin('a.bookmarks', 'b');
$dql->innerjoin('b.refuser', 'u');
$dql->where('b.state LIKE :state');
$dql->setParameters(
['state' => '%publie%']
);

return $dql->getQuery()->getResult();
}

public function findByBookmark()
{
$entityManager = $this->getEntityManager();
$dql = $entityManager->createQueryBuilder();
$dql->select('a');
$dql->from(Category::class, 'a');
$dql->leftJoin('a.bookmarks', 'b');
$dql->innerjoin('b.refuser', 'u');
$dql->where('b.state LIKE :state');
$dql->setParameters(
$queryBuilder = $this->createQueryBuilder('a');
$query = $queryBuilder->leftJoin('a.bookmarks', 'b');
$query->innerjoin('b.refuser', 'u');
$query->where('b.state LIKE :state');
$query->setParameters(
['state' => '%publie%']
);

return $dql->getQuery()->getResult();
return $query->getQuery()->getResult();
}

public function findByPost()
{
$entityManager = $this->getEntityManager();
$dql = $entityManager->createQueryBuilder();
$dql->select('a');
$dql->from(Category::class, 'a');
$dql->leftJoin('a.posts', 'p');
$dql->innerjoin('p.refuser', 'u');
$dql->where('p.state LIKE :state');
$dql->setParameters(
$queryBuilder = $this->createQueryBuilder('a');
$query = $queryBuilder->leftJoin('a.posts', 'p');
$query->innerjoin('p.refuser', 'u');
$query->where('p.state LIKE :state');
$query->setParameters(
['state' => '%publie%']
);

return $dql->getQuery()->getResult();
return $query->getQuery()->getResult();
}

public function findName(string $field)
Expand Down
31 changes: 13 additions & 18 deletions apps/src/Repository/LibelleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,29 @@ public function __construct(ManagerRegistry $registry)

public function findByBookmark()
{
$entityManager = $this->getEntityManager();
$dql = $entityManager->createQueryBuilder();
$dql->select('a');
$dql->from(Libelle::class, 'a');
$dql->innerJoin('a.bookmarks', 'b');
$dql->innerjoin('b.refuser', 'u');
$dql->where('b.state LIKE :state');
$dql->setParameters(
$queryBuilder = $this->createQueryBuilder('a');
$query = $queryBuilder->from(Libelle::class, 'a');
$query->innerJoin('a.bookmarks', 'b');
$query->innerjoin('b.refuser', 'u');
$query->where('b.state LIKE :state');
$query->setParameters(
['state' => '%publie%']
);

return $dql->getQuery()->getResult();
return $query->getQuery()->getResult();
}

public function findByPost()
{
$entityManager = $this->getEntityManager();
$dql = $entityManager->createQueryBuilder();
$dql->select('a');
$dql->from(Libelle::class, 'a');
$dql->innerJoin('a.posts', 'p');
$dql->innerjoin('p.refuser', 'u');
$dql->where('p.state LIKE :state');
$dql->setParameters(
$queryBuilder = $this->createQueryBuilder('a');
$query = $queryBuilder->innerJoin('a.posts', 'p');
$query->innerjoin('p.refuser', 'u');
$query->where('p.state LIKE :state');
$query->setParameters(
['state' => '%publie%']
);

return $dql->getQuery()->getResult();
return $query->getQuery()->getResult();
}

public function findNom(string $field)
Expand Down
1 change: 0 additions & 1 deletion apps/src/Repository/MenuRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public function __construct(ManagerRegistry $registry)
public function findAllCode()
{
$queryBuilder = $this->createQueryBuilder('u');
$query = $queryBuilder->select('u');
$query = $queryBuilder->where(
'u.position=0'
);
Expand Down
3 changes: 1 addition & 2 deletions apps/src/Repository/PostRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(ManagerRegistry $registry)
public function findDateArchive()
{
$queryBuilder = $this->createQueryBuilder('p');
$query = $queryBuilder->innerjoin('p.refuser', 'u');
$query->select(
$query = $queryBuilder->select(
'date_format(p.published,\'%Y-%m\') as code, p.published, COUNT(p)'
);
$query->where(
Expand Down

0 comments on commit d78860e

Please sign in to comment.