Created
June 21, 2018 20:32
-
-
Save CViniciusSDias/d950fa880b5e228980ad966dbe2be7a3 to your computer and use it in GitHub Desktop.
Controller de Contato (Exemplo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing\Annotation\Route; | |
class ContatosController | |
{ | |
/** | |
* @var ExtratorDeContatoPorRequest | |
*/ | |
private $extratorDeContato; | |
/** | |
* @var ManipuladorDeContatos | |
*/ | |
private $manipuladorDeContatos; | |
public function __construct( | |
ExtratorDeContatoPorRequest $extratorDeContato, | |
ManipuladorDeContatos $manipuladorDeContatos | |
) { | |
$this->extratorDeContato = $extratorDeContato; | |
$this->manipuladorDeContatos = $manipuladorDeContatos; | |
} | |
/** | |
* @Route("/contatos", name="listar_contatos") | |
*/ | |
public function listarAction(): Response | |
{ | |
$contatos = $this->manipuladorDeContatos->buscarTodos(); | |
return new JsonResponse($contatos); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment