Skip to content

Fix unused classes #856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions core/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,8 @@ First example:
namespace App\Repository;

use App\Entity\Book;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Doctrine\ORM\Tools\Pagination\Paginator as DoctrinePaginator;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Paginator;
Expand All @@ -407,21 +406,21 @@ use Doctrine\Common\Collections\Criteria;
class BookRepository extends ServiceEntityRepository
{
const ITEMS_PER_PAGE = 20;

private $tokenStorage;

public function __construct(
RegistryInterface $registry,
ManagerRegistry $registry,
TokenStorageInterface $tokenStorage
) {
$this->tokenStorage = $tokenStorage;
parent::__construct($registry, Book::class);
}

public function getBooksByFavoriteAuthor(int $page = 1): Paginator
{
$firstResult = ($page -1) * self::ITEMS_PER_PAGE;

$user = $this->tokenStorage->getToken()->getUser();
$queryBuilder = $this->createQueryBuilder();
$queryBuilder->select('b')
Expand Down Expand Up @@ -482,11 +481,11 @@ namespace App\Repository;
class BookRepository extends ServiceEntityRepository
{
// constant, variables and constructor...

public function getBooksByFavoriteAuthor(int $page = 1): Paginator
{
$firstResult = ($page -1) * self::ITEMS_PER_PAGE;

$user = $this->tokenStorage->getToken()->getUser();
$queryBuilder = $this->createQueryBuilder();
$queryBuilder->select('b')
Expand Down