How to use related() multiple times?

netteman
Member | 122
+
0
-

Hi

I know how to use

$this->database->table('book')->related(...)

https://doc.nette.org/…ase/explorer#… in this database https://ctrlv.cz/…/22/iBkw.png to get to the table book_tag and then to the table tag.

Is it possible to get even to tag_translation and keep the low number of queries generated by nette?

{foreach $books as $book}

    {$book->title}<br />

    {foreach $book->related('book_tag') as $book_tag}

        {$book_tag->tag->name}

        {foreach}
            code to echo translations of a tag
        {/foreach}

    {/foreach}

{/foreach}
stepos2
Member | 51
+
+1
-
{foreach $books as $book}

    {$book->title}<br />

    {foreach $book->related('book_tag') as $book_tag}

        {$book_tag->tag->name}

        {foreach $book_tag->tag->related('tag_translation') as $tag_translation}

			{$tag_translation->translation}<br />

        {/foreach}

    {/foreach}

{/foreach}
netteman
Member | 122
+
0
-

Thank you!