Skip to main content
added 586 characters in body
Source Link
yuvilio
  • 121
  • 4

Is there a way to select parents from multiple child entry ids? For example, I have a blog channel with a playa relationship,via a blog_staff field, to a people channel (to identify authors of blog entries) and a team channel with a playa relationship, via a team_members field, to people as well (to group them into teams). I tried to query for blog entries of multiple people but seem to be limited to only one.

That isI tried the playa field feeding the people entry_ids through an embed to a parents field to grab the associated blog entries:

{exp:playa:parents channel="blog"  entry_id="18"team_members}
    {titleembed="includes/.bp_by_staff" entry_id="{entry_id}"}
{/exp:playa:parentsteam_members}

worksThe (shows correct titles for.bp_by_staff template trying to use those people entry_ids to look up their blog entries by the person with id 18) butposts:

{exp:playa:parents channel="blog"  entry_id="18|29"entry_id="{embed:people}"}
    {title}
{/exp:playa:parents}

does NOT workNow, if {embed:people} is just one entry_id, say "18", this works great, the blog posts get found. But if {embed:people} yields multiple entry ids (shows nothingthe team has more than one person), say "18|29", it doesn't work.

Looking through the profiler itfor the generated sql of the failing case, one can see why. It seems like including more than one entry_id breaks the sql query which uses "=" rather than " in " for the where clause:

SELECT DISTINCT(rel.parent_entry_id) AS entry_id
FROM exp2_playa_relationships rel 
WHERE rel.child_entry_id = 18|29

If the where clause were using "in" as in WHERE rel.child_entry_id in (18, 29) this would workthe query works correctly.

Anyone find a workaround for getting results for multiple entry_ids ?

Is there a way to select parents from multiple child entry ids? For example, I have a blog channel with a playa relationship to a people channel (to identify authors of blog entries). I tried to query for blog entries of multiple people but seem to be limited to only one.

That is:

{exp:playa:parents channel="blog"  entry_id="18"}
    {title}
{/exp:playa:parents}

works (shows correct titles for blog entries by the person with id 18) but

{exp:playa:parents channel="blog"  entry_id="18|29"}
   {title}
{/exp:playa:parents}

does NOT work (shows nothing).

Looking through the profiler it seems like including more than one breaks the sql query which uses "=":

SELECT DISTINCT(rel.parent_entry_id) AS entry_id
FROM exp2_playa_relationships rel 
WHERE rel.child_entry_id = 18|29

If the where clause were using "in" as in WHERE rel.child_entry_id in (18, 29) this would work correctly.

Anyone find a workaround for getting results for multiple entry_ids ?

Is there a way to select parents from multiple child entry ids? For example, I have a blog channel with a playa relationship,via a blog_staff field, to a people channel (to identify authors of blog entries) and a team channel with a playa relationship, via a team_members field, to people as well (to group them into teams). I tried to query for blog entries of multiple people but seem to be limited to only one.

I tried the playa field feeding the people entry_ids through an embed to a parents field to grab the associated blog entries:

{team_members}
    {embed="includes/.bp_by_staff" entry_id="{entry_id}"}
{/team_members}

The .bp_by_staff template trying to use those people entry_ids to look up their blog posts:

{exp:playa:parents channel="blog"  entry_id="{embed:people}"}
    {title}
{/exp:playa:parents}

Now, if {embed:people} is just one entry_id, say "18", this works great, the blog posts get found. But if {embed:people} yields multiple entry ids (the team has more than one person), say "18|29", it doesn't work.

Looking through the profiler for the generated sql of the failing case, one can see why. It seems like including more than one entry_id breaks the sql query which uses "=" rather than " in " for the where clause:

SELECT DISTINCT(rel.parent_entry_id) AS entry_id
FROM exp2_playa_relationships rel 
WHERE rel.child_entry_id = 18|29

If the where clause were using "in" as in WHERE rel.child_entry_id in (18, 29) the query works correctly.

Anyone find a workaround for getting results for multiple entry_ids ?

Post Undeleted by yuvilio
Post Deleted by yuvilio
Source Link
yuvilio
  • 121
  • 4

Playa parent multiple entry_ids

Is there a way to select parents from multiple child entry ids? For example, I have a blog channel with a playa relationship to a people channel (to identify authors of blog entries). I tried to query for blog entries of multiple people but seem to be limited to only one.

That is:

{exp:playa:parents channel="blog"  entry_id="18"}
    {title}
{/exp:playa:parents}

works (shows correct titles for blog entries by the person with id 18) but

{exp:playa:parents channel="blog"  entry_id="18|29"}
   {title}
{/exp:playa:parents}

does NOT work (shows nothing).

Looking through the profiler it seems like including more than one breaks the sql query which uses "=":

SELECT DISTINCT(rel.parent_entry_id) AS entry_id
FROM exp2_playa_relationships rel 
WHERE rel.child_entry_id = 18|29

If the where clause were using "in" as in WHERE rel.child_entry_id in (18, 29) this would work correctly.

Anyone find a workaround for getting results for multiple entry_ids ?