Skip to content

Commit

Permalink
Blog Factoring
Browse files Browse the repository at this point in the history
  • Loading branch information
RamiAouinti committed Nov 15, 2024
1 parent f19064e commit b74b149
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 34 deletions.
17 changes: 0 additions & 17 deletions src/Blog/Transport/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,12 @@ public function index(

$latestPosts = $posts->findLatest($page, $tag);

// Every template name also has two extensions that specify the format and
// engine for that template.
// See https://symfony.com/doc/current/templates.html#template-naming
return $this->render('blog/index.' . $_format . '.twig', [
'paginator' => $latestPosts,
'tagName' => $tag?->getName(),
]);
}

/**
* NOTE: when the controller argument is a Doctrine entity, Symfony makes an
* automatic database query to fetch it based on the value of the route parameters.
* The '{slug:post}' configuration tells Symfony to use the 'slug' route
* parameter in the database query that fetches the entity of the $post argument.
* This is mostly useful when the route has multiple parameters and the controller
* also has multiple arguments.
* See https://symfony.com/doc/current/doctrine.html#automatically-fetching-objects-entityvalueresolver.
*/
#[Route(
'/posts/{slug:post}',
name: 'blog_post',
Expand Down Expand Up @@ -161,11 +149,6 @@ public function commentNew(
]);
}

/**
* This controller is called directly via the render() function in the
* blog/post_show.html.twig template. That's why it's not needed to define
* a route name for it.
*/
public function commentForm(Post $post): Response
{
$form = $this->createForm(CommentType::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
use App\User\Domain\Entity\User;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Throwable;
Expand Down
5 changes: 2 additions & 3 deletions src/Platform/Application/Service/MailerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
use Symfony\Component\Mime\Email;

/**
* Class MailerService
* @package App\Platform\Application\Service
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
* @package App\Platform\Application\Service
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
readonly class MailerService implements MailerServiceInterface
{
Expand Down
3 changes: 1 addition & 2 deletions src/Platform/Application/Service/MessageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

namespace App\Platform\Application\Service;

use App\Platform\Application\Service\Interfaces\MessageServiceInterface;
use App\Platform\Transport\Message\Interfaces\MessageHighInterface;
use App\Platform\Transport\Message\Interfaces\MessageLowInterface;
use App\Platform\Application\Service\Interfaces\MessageServiceInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface;

/**
* Class MessageService
* @package App\Platform\Application\Service
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\HttpKernel\KernelEvents;

/**
* Class ControllerSubscriber
* @package App\Blog\Transport\EventSubscriber
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use function Symfony\Component\String\u;

/**
* Class RedirectToPreferredLocaleSubscriber
* @package App\Platform\Transport\EventSubscriber
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
1 change: 0 additions & 1 deletion src/Platform/Transport/Form/Type/DateTimePickerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use function Symfony\Component\String\u;

/**
* Class DateTimePickerType
* @package App\Platform\Transport\Form\Type
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
1 change: 0 additions & 1 deletion src/Tag/Domain/Entity/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Throwable;

/**
* Class Tag
* @package App\Tag\Domain\Entity
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use function Symfony\Component\String\u;

/**
* Class TagArrayToStringTransformer
* @package App\Blog\Transport\Form\DataTransformer
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
1 change: 0 additions & 1 deletion src/Tag/Transport/Form/Type/TagsInputType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Symfony\Component\Form\FormView;

/**
* Class TagsInputType
* @package App\Blog\Transport\Form\Type
* @author Rami Aouinti <rami.aouinti@tkdeutschland.de>
*/
Expand Down
5 changes: 1 addition & 4 deletions src/User/Transport/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ final class SecurityController extends AbstractController
use TargetPathTrait;

/**
* @param User|null $user
* @param Request $request
* @param AuthenticationUtils $helper
* @return Response
* @param User|null $user
*/
#[Route('/login', name: 'security_login')]
public function login(
Expand Down
1 change: 1 addition & 0 deletions src/User/Transport/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function changePassword(

if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();

return $security->logout(validateCsrfToken: false) ?? $this->redirectToRoute('homepage');
}

Expand Down

0 comments on commit b74b149

Please sign in to comment.