Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering with translated content #580

Open
bobvandevijver opened this issue Jul 15, 2013 · 7 comments
Open

Filtering with translated content #580

bobvandevijver opened this issue Jul 15, 2013 · 7 comments

Comments

@bobvandevijver
Copy link
Member

Is it possible to filter on translated content?

I am using https://github.com/KnpLabs/DoctrineBehaviors for the translations, and https://github.com/a2lix/TranslationFormBundle to edit the translations fields.

If it is not possible (yet), than I would like to make this a feature request.

@ioleo
Copy link
Member

ioleo commented Jul 15, 2013

There is no such feature now. Adding this to v1.1.0 ideas.

@cedriclombardot
Copy link
Member

I think you can override methods to do that in your controller look the
good method name in the cache

Le lundi 15 juillet 2013, loostro [email protected] a écrit :

There is no such feature now. Adding this to v1.1.0 ideas.


Reply to this email directly or view it on GitHub.

@montabou
Copy link
Contributor

I had the same problem and I solve it overwriting this in my ListController :

    protected function processQuery($query)
    {
       return $query
            ->where('translations.locale = :locale')
            ->setParameter('locale', $this->getRequest()->getLocale())
        ;
    }

@ioleo
Copy link
Member

ioleo commented Jul 26, 2013

@bobvandevijver @montabou If this solution works, could you make a PR to update the Resources/doc/cookbook/a2lixTranslationFormBundle-integration.md docs?

@bobvandevijver
Copy link
Member Author

@loostro @montabou I will try it this weekend!

@montabou
Copy link
Contributor

@bobvandevijver After rereading your problem I'm not sure that it will resolve yours.

Using what I did just filter with current locale so that sort (for example) is performed on translated content and not all translations.

It will not let you filter after that on some fields using the generator.yml as I guess it's not possible until issue #434 is not resolved

@montabou
Copy link
Contributor

After using my solution I've just figured out that it works only if there is a addJoinFor call before (with sorting on translations.something). So it's rubbish, sorry for that :-(

PS: Well it works if you test if you have to leftJoin with translations before...

@ioleo ioleo added this to the v2.0 milestone Jun 20, 2014
@ioleo ioleo self-assigned this Jun 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants