Skip to content

Examples for custom controllers #638

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 5 commits into from
Nov 5, 2018
Merged

Conversation

martinharder
Copy link
Contributor

Many are missing examples how to use pagination with custom controllers.
This could help.

Many are missing examples how to use pagination with custom controllers.
This could help.
use ApiPlatform\Core\Bridge\Doctrine\Orm\Paginator;
use Doctrine\Common\Collections\Criteria;

class BookService
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be the BookRepository directly right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class GetBooksByFavoriteAuthorAction extends Controller
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be AbstractController IIRC

dunglas and others added 3 commits November 2, 2018 12:46
Co-Authored-By: martinharder <[email protected]>
Co-Authored-By: martinharder <[email protected]>
The method is moved to the registry.
Controller extends AbstractController.
@dunglas dunglas merged commit 26c88ed into api-platform:2.3 Nov 5, 2018
@dunglas
Copy link
Member

dunglas commented Nov 5, 2018

Thanks @martinharder!

@martinharder
Copy link
Contributor Author

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants