Shhhht! The crew is at work 🤫
Discover the baksla.sh team members while they're working
💡 Click on a member to discover their full profile.
@@ -10,7 +10,7 @@
10
use App\Team\Infrastructure\InMemory\InMemoryMemberRepository;
11
use Symfony\Component\HttpFoundation\Exception\NotFoundHttpException;
12
use Symfony\Component\HttpFoundation\Request;
13
use Symfony\Component\HttpFoundation\Response;
14
use Symfony\Component\HttpKernel\Attribute\AsController;
15
use Symfony\Component\Routing\Attribute\Route;
16
use Twig\Environment;

Hugo Alliaume
- UX Core Team
Could we alias this import to Twig to make it a little more understandable?

Félix Eymonot
- Certified
What about extending AbstractController and use the render() method?
17
18
#[AsController]
19
final readonly class ViewTeam
20
{
21
public function __construct(
22
private Environment $twig,
23
private InMemoryMemberRepository $memberRepository,

Robin Chalas
- Co-Founder / Consultant
- Core Team
This should depend on an interface instead to avoid coupling to implementation details

Mathias Arlaud
- Co-Founder / Consultant
- Core Team
- Certified
👍 That Repository contract belongs to the Domain layer IMHO.

Jérémy Romey
- Certified
To target a specific implementation, you can use the Autowire attribute.
24
) {
25
}
26
27
#[Route(name: 'app_team', path: '/team')]
28
public function __invoke(Request $request): Response
29
{
30
return new Response();
30
if ('GET' !== $request->getMethod()) {
31
throw new NotFoundHttpException();

Arnaud De Abreu
- Certified
While it works, #[Route(methods: ['GET'])] is a better way to achieve this.

Valmont Pehaut Pietri
Indeed, better leverage Symfony Routing capabilities so you can focus on the business logic.
32
}
33
34
return new Response($this->twig->render('pages/team/index.html.twig', [
35
'members' => $this->memberRepository->findAll(),

Jules Pietri
- Certified
- Former Core Team
Should it return a paginated result instead?

Yazid Hassani
AFAIK, baksla.sh isn't gonna have enough members to need pagination anytime soon 😉
36
]);
36

Jules Pietri
- Certified
- Former Core Team
Extra blank line 👀
30
}
Reviewers (9)









Reviewers (9)
-
Arnaud De Abreu
-
Félix Eymonot
-
Hugo Alliaume
-
Jérémy Romey
-
Jules Pietri
-
Mathias Arlaud
-
Robin Chalas
-
Valmont Pehaut Pietri
-
Yazid Hassani