Skip to content

Too many db queries with collectionOperations #10

Description

@CHenzel

First of all thank you for this good bundle.

It works very well.

But looking more closely at the number of doctrine queries via the symfony profiler.
I notice that there are a lot of duplicate requests when we get the translations.

Example: if the collection contains 6 elements, we have 6 times the same request.

SELECT t0.id AS id_1, t0.title AS title_2, t0.content AS content_3, t0.meta_description AS meta_description_4, t0.seo_title AS seo_title_5, t0.slug AS slug_6, t0.locale AS locale_7, t0.translatable_id AS translatable_id_8 FROM blog_post_translation t0 WHERE (t0.locale = ? AND t0.translatable_id = ?)
Parameters:
[▼
  "en"
  1
]

I had the same problem with Gedmo\Translatable and I used the TranslationWalker. Would it be possible to use something equivalent?

use Doctrine\ORM\Query;
use Gedmo\Translatable\Query\TreeWalker\TranslationWalker;
...
$query->setHydrationMode(TranslationWalker::HYDRATE_OBJECT_TRANSLATION);
$query->setHint(Query::HINT_REFRESH, true);

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions