Skip to content

Conversation

vgreb
Copy link
Contributor

@vgreb vgreb commented Jul 30, 2025

Migration de l'administration de articles sous Symfony.
La nouvelle url dans le menu est /admin/site/articles

J'ai volontairement laissé les sources legacy. Si la MR est validée, je ferais une seconde MR pour les supprimer.

@vgreb vgreb force-pushed the refacto/articles branch 4 times, most recently from 9203f65 to 767d4a9 Compare July 31, 2025 05:55
@@ -38,3 +38,9 @@
</div>
{%- endif -%}
{%- endblock datetime_widget -%}

{%- block textarea_widget -%}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il est peut être plus judicieux d'utiliser la macro wysiwyg() présente dans templates/admin/event/form.html.twig, quite à la déplacer dans le form_theme_admin.html.twig.
Qu'en pensez-vous ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si ça rend le code plus clair pourquoi pas.

Attention par contre à si ça modifie beaucoup de fichiers, ce sera mieux de faire ça dans une PR séparée.

@vgreb vgreb marked this pull request as ready for review July 31, 2025 06:07
@vgreb vgreb force-pushed the refacto/articles branch from 767d4a9 to 9b338cd Compare August 1, 2025 18:45
@vgreb vgreb changed the title refacto: migration de l'administrations des articles sous Symfony refacto: migration de l'administration des articles sous Symfony Aug 1, 2025
'filter' => $article->getTitle(),
]);
}
dump($article);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

if ($form->isSubmitted() && $form->isValid()) {
$this->articleRepository->save($article);
$this->log('Modification de l\'article ' . $article->getTitle());
$this->addFlash('notice', 'L\'article ' . $article->getTitle() . ' a été modifiée');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->addFlash('notice', 'L\'article ' . $article->getTitle() . ' a été modifiée');
$this->addFlash('notice', 'L\'article ' . $article->getTitle() . ' a été modifié');

private readonly ArticleRepository $articleRepository,
) {}

public function __invoke(int $id,Request $request): Response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function __invoke(int $id,Request $request): Response
public function __invoke(int $id, Request $request): Response

Comment on lines 51 to 53
/**
* @var int
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu peux enlever le docblock du coup

Comment on lines 355 to 357
/**
* @return int|null
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas besoin de docblock

*
* @return $this
*/
public function setPosition($position): self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autant en profiter pour avoir un type natif (et pareil pour authorId)

Suggested change
public function setPosition($position): self
public function setPosition(?int $position): self

return $this;
}

public function useMarkdown(): bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce serait plus correct comme ça, sinon ça ressemble à un setter.

Suggested change
public function useMarkdown(): bool
public function usesMarkdown(): bool

@@ -239,6 +239,39 @@ public function findNewsBySlug($slug)
return $events->first();
}

public function getAllArticlesWithCategoryAndTheme($ordre = 'titre', $direction = 'desc', string $filtre = '%')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function getAllArticlesWithCategoryAndTheme($ordre = 'titre', $direction = 'desc', string $filtre = '%')
public function getAllArticlesWithCategoryAndTheme(string $ordre = 'titre', string $direction = 'desc', string $filtre = '%')


if ($form->isSubmitted() && $form->isValid()) {
$this->articleRepository->save($article);
$this->log('Ajout de la rubrique ' . $article->getTitle());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->log('Ajout de la rubrique ' . $article->getTitle());
$this->log('Ajout de l\'article ' . $article->getTitle());

@vgreb vgreb force-pushed the refacto/articles branch from 9b338cd to fa7f862 Compare August 16, 2025 17:29
@vgreb vgreb force-pushed the refacto/articles branch from fa7f862 to 78ea080 Compare August 17, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants