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

Relationship field selection gives array_merge warning & filed name error with Pods 2.1 #860

Closed
vjanagaran opened this issue Dec 11, 2012 · 7 comments
Assignees
Milestone

Comments

@vjanagaran
Copy link

We are getting following warning while trying to use relationship filed in the where clause

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in ...\wp-content\plugins\pods\classes\PodsData.php on line 2078

Also getting following warning while we try 3rd level relationship

Warning: array_merge() [function.array-merge]: Argument #3 is not an array in ...\wp-content\plugins\pods\classes\PodsData.php on line 2056

Finally relationship field names are getting changed as follows:

$params['where'] = "university.name` ='" . mysql_escape_string($d[0]) . "' and course.name='" . mysql_escape_string($d[2]) . "' and course.degree.degree_code='" . mysql_escape_string($d[1]) . "' and t.mode='" . mysql_escape_string($d[3]) . "'";

Error:

Database Error; SQL: SELECT DISTINCT t.id FROM ap_pods_university_course AS t WHERE university.name ='Gurukula Kangri Vishwavidyalaya' and course.name='Zoology & Environmental Science' and course_degree.degree_code='M.Sc' and t.mode='Full Time' ORDER BY t.name, t.id LIMIT 0, 15; Response: Unknown column 'university.name' in 'where clause'

But it was worked before upgrading into 2.1

@vjanagaran
Copy link
Author

It happens only if we have 3rd level reference. in my case its course.degree.degree_code

it works fine for second level. Any Idea?

@pglewis
Copy link
Contributor

pglewis commented Dec 20, 2012

Can you give me details for:

  • The types of Pods involved in the join
  • Exact pod and field names involved
  • Any field details that would be handy to reproduce it myself: single or multi-select and "format" from advanced options

I probably don't need the entire list of pods and every field, just enough to be able to put something together from scratch that demonstrates the error. The quicker it is for me to see it myself, the quicker we can get it fixed up.

@vjanagaran
Copy link
Author

Hi,
Thanks for your support, totally 3 pods (adv. content type) involved with this join

  1. Pod: 'degree' which has text field filed called 'degree_code'

  2. Pod: 'course' which has relationship filed called 'degree'

  3. Pod: 'university' which has text field called 'name' (optional for your test)

  4. Pod: 'university_course' which has relationship field name called course and relationship filed called 'university'

Now i wants to select list of courses offered by university based 'M.S' degree code by selecting relationship from 'university_course' pod object like

$params['where'] = "university.name` ='xxxxxx' and course.degree.degree_code='M.S'";

$univ_course = pods('university_courses', $params);

I'm getting error only we try to select in the third level

@pglewis
Copy link
Contributor

pglewis commented Dec 20, 2012

Thanks, I'll get around to this tonight.

sc0ttkclark added a commit that referenced this issue Dec 20, 2012
@sc0ttkclark
Copy link
Member

Try http://pods.io/latest/ and let me know if it's working for you now

@ghost ghost assigned sc0ttkclark Dec 20, 2012
@vjanagaran
Copy link
Author

Hi,
Thanks for your time & effort. I tested with test installation and works fine. I'm moving to production site

Let you know if any issue. :)

@vjanagaran
Copy link
Author

Tested in production site with sc0ttkclark's fix. Its working fine

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

3 participants