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

Add a option to select the joined tables for association filtering. #39

Open
neos-bot opened this issue Mar 12, 2015 · 3 comments
Open

Comments

@neos-bot
Copy link
Owner

Jira issue originally created by user baumgartl:

If you have a hierarchy like this:

  • Show
    **** Season
    ***** Episode

And want to filter the shows by a property of the episodes you can do this with (Repository find method):

$query = $this->createQuery();

$constraint = $query->equals('seasons.episodes.propertyName', 'operand');

$query->matching($constraint)->execute();

But if you want to get the seasons with $show->getSeaons() for this filtered list, you get ALL linked seasons. The same applies for episodes.

With the attached path, you can add all joined tables to the query select. The result will be mapped to the objects and the get seasons and get episodes method only returns the filtered entities.

Atachements:

Jira Image

Jira-URL: https://jira.neos.io/browse/FLOW-232

@neos-bot
Copy link
Owner Author

Comment created by baumgartl:

Another way is to guess the join aliases and add them to the select manually:

/*** @var Query $query **/
$queryBuilder = $query->getQueryBuilder();

$queryBuilder->addSelect('seasons0', 'episodes1');

@neos-bot
Copy link
Owner Author

Comment created by baumgartl:

I think it would be generally worthy if we had the possibility to add associations (join tables) to a query without to know the table aliases.

@neos-bot
Copy link
Owner Author

neos-bot commented Dec 9, 2015

Comment created by lubitz:

+1 from me. Doctrine already supports that, so why not the flow query interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant