This commit is contained in:
Simon Vieille 2021-03-30 21:27:57 +02:00
parent 04662fac05
commit 6cf38a56cb
2 changed files with 11 additions and 3 deletions

View file

@ -41,7 +41,15 @@ class MigrateDataCommand extends Command
foreach ($this->postRepo->create()->find() as $post) foreach ($this->postRepo->create()->find() as $post)
{ {
$tags = $post->getTags(); $tags = $post->getTags();
$post->setTags($tags); $newTags = [];
foreach ($tags as $k => $v) {
if (!empty($v['label'])) {
$newTags[] = $v;
}
}
$post->setTags($newTags);
$this->entityManager->update($post); $this->entityManager->update($post);
} }

View file

@ -25,8 +25,8 @@
{% for tag in post.tags %} {% for tag in post.tags %}
<li> <li>
<a href="{{ safe_path('blog_menu_search', {tag: tag.value}) }}"> <a href="{{ safe_path('blog_menu_search', {tag: tag.label}) }}">
{{- '#' ~ tag.value -}} {{- '#' ~ tag.label -}}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}