refactoring url generator
This commit is contained in:
parent
d38663da4f
commit
012588de7b
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\UrlGenerator;
|
namespace App\UrlGenerator;
|
||||||
|
|
||||||
|
use App\Core\Entity\Site\Node;
|
||||||
use App\Entity\Blog\Category;
|
use App\Entity\Blog\Category;
|
||||||
use App\Repository\Blog\CategoryRepositoryQuery;
|
use App\Repository\Blog\CategoryRepositoryQuery;
|
||||||
use App\Repository\Blog\PostRepositoryQuery;
|
use App\Repository\Blog\PostRepositoryQuery;
|
||||||
|
@ -28,7 +29,7 @@ class PostGenerator
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function post(): array
|
public function post(Node $node, array $options): array
|
||||||
{
|
{
|
||||||
$entities = $this->postQuery->create()
|
$entities = $this->postQuery->create()
|
||||||
->published()
|
->published()
|
||||||
|
@ -39,7 +40,7 @@ class PostGenerator
|
||||||
|
|
||||||
foreach ($entities as $entity) {
|
foreach ($entities as $entity) {
|
||||||
$urls[] = $this->urlGenerator->generate(
|
$urls[] = $this->urlGenerator->generate(
|
||||||
'blog_menu_post',
|
$node->getRouteName(),
|
||||||
[
|
[
|
||||||
'post' => $entity->getId(),
|
'post' => $entity->getId(),
|
||||||
'slug' => $entity->getSlug(),
|
'slug' => $entity->getSlug(),
|
||||||
|
|
Loading…
Reference in a new issue