Skip to content

Instantly share code, notes, and snippets.

@franzose
Last active July 15, 2019 15:10
Show Gist options
  • Save franzose/f501d521e76d35d655255da9fad0ecf3 to your computer and use it in GitHub Desktop.
Save franzose/f501d521e76d35d655255da9fad0ecf3 to your computer and use it in GitHub Desktop.
<?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