Skip to content

Instantly share code, notes, and snippets.

@ahmed-bhs
Last active November 6, 2018 18:46
Show Gist options
  • Save ahmed-bhs/066a29232ffab0a8d4e2bea0f7a1aa57 to your computer and use it in GitHub Desktop.
Save ahmed-bhs/066a29232ffab0a8d4e2bea0f7a1aa57 to your computer and use it in GitHub Desktop.
<?php declare(strict_types=1);
namespace App\Controller\Article;
use App\Controller\AbstractRestController;
use App\Entity\Article;
use FOS\RestBundle\Controller\Annotations as FOSRest;
use FOS\RestBundle\Request\ParamFetcherInterface;
/**
* Class ArticleController.
*/
class ArticleController
{
private $form;
public construct __construct(FormFactoryInterface $form)
{
$this->form = $form;
}
/**
* @param ParamFetcherInterface $paramFetcher
* @FOSRest\QueryParam(name="page", requirements="\d+", default="1")
*
* @FOSRest\View()
*/
public function __invoke(Request $request, ParamFetcherInterface $paramFetcher)
{
return $this->em->getRepository(Article::class)->findAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment