Skip to content

Instantly share code, notes, and snippets.

@franzose
Last active Jul 15, 2019
Embed
What would you like to do?
<?php
class MakeCoolStuff extends AbstractController
{
public function __construct(
EntityManagerInterface $manager,
YourFunkyService $service
) {
$this->manager = $manager;
$this->service = $service;
}
public function __invoke(SomeEntityFormRequest $request, User $user): JsonResponse
{
$vacancy = $this->service->createFromRequest($request, $user);
$this->manager->persist($vacancy);
$this->manager->flush();
return new JsonResponse([
'message' => 'Что-то там успешно создано!'
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment