sous avec twig

Par Yohan Bourigault, il y a 7 ans


Bonjour,

Voila je rencontre un petit problème avec mon code, dans mon twig , j'arrive a recuré le post sans soucis , mais pas le parent , et j'en ai besoin pour creer une arbo de view.

    return $this->renderer->render('@project/show', [
        'post' => $post,
        'parent' => $cat
    ]);

3 réponses

Yohan Bourigault, il y a 7 ans

en fait il me faudrait ces trois path dans le meme module

$router->get($prefix . '/{cat:[%a-z\-0-9]+}', CategoryAction::class, 'category.show'); $router->get($prefix . '/{cat:[%a-z\-0-9]+}{pro:[%a-z\-0-9]+}', CategoryAction::class, 'category.show'); $router->get($prefix . '/{cat:[%a-z\-0-9]+}{pro:[%a-z\-0-9]+}{art:[%a-z\-0-9]+}', CategoryAction::class, 'category.show');

mais twig ne me les creer pas je ne peux en crrer qu'un seul dans ma vue

<a href="{{ path('category.show', { cat: post.Cat_Name }) }}">
Yohan Bourigault, il y a 7 ans

voila , j'ai trouvé :)
dans le show de ma category au lieu d'afficher la view catégory , je peux afficher la liste de project enfants en changeant de table :)

public function show(Request $request) { $cat = $request->getAttribute('cat'); $post = $this->postTable->find($request->getAttribute('cat')); /*if ($post->Cat_Name !== $cat) { return $this->redirect('category.show', [ 'cat' => $cat ]); }*/ return $this->renderer->render('@project/index', [ 'post' => $post ]); }
Yohan Bourigault, il y a 7 ans

tu cherche une erreur pendant une heure et tu vois ca !!!

public function findAll(iny $parentId)