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

Problem with Query #576

Closed
HerrHase opened this issue Nov 4, 2014 · 13 comments
Closed

Problem with Query #576

HerrHase opened this issue Nov 4, 2014 · 13 comments

Comments

@HerrHase
Copy link

HerrHase commented Nov 4, 2014

Hello :)

There is a Problem with Quries. I have a Document Media, that have as Children different Types of Attribute-Classes. One Type referrer to Documents that represent a Tag. The Problem is the Query, to get only Media with a specific Tag I join Media with Attribute. That works and I only get Media that have Children with the Attribute-Tag-Class, BUT when I join Attribute with Tags, I get the error “Join with Joins”. But this a little bit Strange, or is there another way? Also there is no whereIn-Function to filter more than one tag on the same query.

$queryBuilder->from('p')->document('MediaBundle\Document\Media', 'p');
$queryBuilder
    ->addJoinInner()
    ->right()->document('MediaBundle\Document\Attribute\Tag', 'a')->end()
    ->condition()->child('a', 'p')->end();

$queryBuilder
    ->addJoinInner()
    ->right()->document('MediaBundle\Document\Taxon', 't')->end()
    ->condition()->equi('a.taxon', 't.uuid')->end();
@dantleech
Copy link
Contributor

Maybe you could try the other syntax (i.e. do not use addJoinInner) and add your join under the ->left() node?

@HerrHase
Copy link
Author

HerrHase commented Nov 4, 2014

Ahhh, reading saves time, i hadn't realized that he throws a "Jackalope\NotImplementedException" sorry, it's my fault. Any Idea when this Feature will be implemented?

@dantleech
Copy link
Contributor

Which implementation are you using? doctrine-dbal or jackrabbit?

@HerrHase
Copy link
Author

HerrHase commented Nov 4, 2014

doctrine-dbal

@dantleech
Copy link
Contributor

You might try the jackrabbit implementation, which I guess should support this. I am not sure how much work is would be to support joining joins in doctrine-dbal /cc @dbu @lsmith77

Although, have you considered a different approach?

If Attribute is a subtype of Tag you can simply join Tag and you should get both Attribute and Tag documents.

@HerrHase
Copy link
Author

HerrHase commented Nov 5, 2014

I think that will not work, the Problem is that each Attribute-Class has a body variable that has a another implementation. For the AttributeTag-Class is refers to Tags. But Thanks for your help, i will try a workaround and hope that joining joins will be implemented.

/**
 * @PHPCR\Referrers(
 *   referringDocument="MediaBundle\Document\Taxon",
 *   referencedBy="contents"
 * )
*/
protected $body;

@dbu
Copy link
Member

dbu commented Dec 5, 2014

@bjoernhase did you find a workaround? @dantleech does this isse need to stay open, is this something not implemented? but if jackalope-jackrabbit does not work, i guess its rather a limitation of the SQL2 specification?

@dantleech
Copy link
Contributor

The SQL2 specification supports it.

The following query works on Jackrabbit, but not on Doctrine-Dbal:

SELECT * FROM [nt:unstructured] AS a 
    INNER JOIN [nt:unstructured] AS b ON ISCHILDNODE(b,a) 
    INNER JOIN [nt:unstructured] AS c ON ISCHILDNODE(c,b);

@dbu
Copy link
Member

dbu commented Dec 5, 2014

so should this be an issue on https://github.com/jackalope/jackalope-doctrine-dbal? if so, can you create it there with a good description dan?

@dantleech
Copy link
Contributor

Hmm, not sure. It is the parser (phpcr-utils which does not parse the query). I don't know if doctrine-dbal supports it or not. Will create an issue there.

@dantleech
Copy link
Contributor

See phpcr/phpcr-utils#140

@HerrHase
Copy link
Author

HerrHase commented Dec 7, 2014

@dbu yes, i have, but it is not a really good one. I have create a array that contains the uuid of each object in taxons. Each Time Taxons will be upated the array will be synchronize.

@dbu
Copy link
Member

dbu commented Jan 18, 2018

closing due to inactivity

@dbu dbu closed this as completed Jan 18, 2018
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

3 participants