Closed (fixed)
Project:
Entity API
Version:
7.x-1.x-dev
Component:
Code - misc
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2011 at 01:09 UTC
Updated:
8 Nov 2011 at 22:50 UTC
Jump to comment: Most recent file
Comments
Comment #2
sunAnd this one works. :)
Comment #3
sunAnd now for real.
Comment #4
johnv(How) does this patch influence/interact with the following patch which enables reverse relationships in Views itself?
Http://drupal.org/node/1043260
Comment #5
sunThanks for pointing to #1043260: Reverse relationship -- however, I'm not sure whether a completely generic approach within Views itself is going to work out. Obviously, it would make this entire code and patch unnecessary, but as of now, I doubt that Views will be able to add built-in support anytime soon.
Comment #6
fagoGreat idea!
This changes are confusing me, as still $data is written only once? So I don't think we need to do that.
Hm, so if the views data would be built multiple times on a page request, the controller would add in the same relationship multiple times? I've just moved that over to views_data().
I've tried to come up with an auto-generated help text for the reverse relationship and updated the patch. Patch works for me, however perhaps we should do something like entity_lcfirst() which works like lcfirst() in PHP 5.3? I miss drupal_lcfirst().
Comment #7
fagoCorrect patch.
Comment #8
roam2345 commentedBeen testing this out as I need the reverse relation ship with something im doing with profile2.
Once applied the patch I keep getting.
Comment #9
sun@jucallme: Odd - didn't get this error with my patch. Didn't test @fago's patch yet. I'm not able to see an essential difference between the two patches, but I'm pretty sure that I should've gotten that error as well, since I also tested with profile2 and 'uid' exists on both tables. Hence, something must be different.
Comment #10
roam2345 commented@sun yeah I need to give it another once over to figure out exactly what went wrong.. I created a patch for profile2 to do these views relationships there. Fargo pointed me here, so I removed my patched version of profile2 and patched entity API (dev) with this. Re configured my views flush all the caches and it kept spazzing out with that error, used fargo's patch.
I had to release with my patched version of profile2, but should have time 2m / Monday to get down and dirty with this as it's the way forward. So I'll get better feed back then..
Side note, strange that my watch list not have this issue in it.. Must be something changed since git down time.
Comment #11
roam2345 commentedAs promised, retested this.
The reason I was getting
Was due to the fact that I did not update the UID field in my out put of the view. It was still using the old relation ship from the patched version of my profile2.
All is good use this quite extensively building some hefty views, and its green lights all round. http://www.astuteresourcing.com/ currently has this patch applied and we use it for all the profile 2 entities we have defined.
Thanks, @sun and @fargo.
Comment #12
fagoSounds good. @sun: Does the patch in #7 work for you too?
Comment #13
sunDidn't test and won't be able to test soon, but I also don't see incompatible differences, so let's proceed.
Comment #14
roam2345 commentedSorry but further testing my side im getting into this case
This is only happening when I add a field filter of profile2 type... looks like there is an escape char sneaking its way in.
Not sure if this is a views issue or ours, as it works in the preview. But as soon as I save the view it throws this.
Comment #15
sunThe actual error is in .type:
You might have to specify the relation to use for the profile type condition.
Comment #16
Shadlington commentedSubscribe
Comment #17
fagoCommitted, thanks.
Comment #19
steinmb commentedNot entire sure this is 100% fixed, still have problems with profile2. The page is a simple view (basetable, content) showing just a few fields of a news article, so nothing fancy. I'm sorry if I'm barking up the wrong tree, it might be a profile2 or views issue..
Setup:
Entity API 7.x-1.x-dev (2011-mar-22)
ctools 7.x-1.0-alpha4
profile2 7.x-1.0-beta2
Views 7.x-3.0-beta3
Not really sure how this all works, but I'm guessing that profile2 build a new enity but some how this fail. I looked on the query generated by views
Tried to run this manually against the db. and it is correct, this does not work, "profile.pid AS profile_pid"
Comment #20
fago>'Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column \'profile.pid\' in \'field list\''
Sounds like your mysql table is missing the column. Anyway, please open new issues for any general views integration troubles.
Comment #21
bryancasler commentedsubscribe
Comment #22
dargno commentedsubscribing
Got the same SQL error as above;
Can we just add the column manually to fix the issue?
Comment #23
d.holmen@gmail.com commentedSubscribing
Comment #24
SeanBot2000 commentedSubscribing
I am also getting this error trying to expose profile data in a view.
Comment #25
smk-ka commentedThis isn't sufficient: if you have more than one entity property that links to another entity of the same type (i.e., same
$info['base table']), you're overwriting any previously set relationships.$this->relationshipsneeds to take the current field into account, and pass that information up to entity_views_data().Comment #26
smk-ka commentedThe fix is simple, but requires updating all views...
Comment #27
crifi commented+1
Comment #28
fagoouch. People won't be happy with that, but we need to fix this. -> committed.
Comment #29
fagoComment #30
carnity commentedentity.views-relations-reversed.0.patch queued for re-testing.
Comment #31
crifi commentedIssue was fixed and committed, see #28!
Comment #33
fagoouch, #26 is going to break everyone's og views ... We should re-evaluate it.
Proposal: Keep the name of the first reverse-relationship to the old name, re-name all others.
Comment #34
fagook, I've done so and committed it. See http://drupalcode.org/project/entity.git/commit/f0728d1
This means, user of the dev version might have to update their relationships *again* - sry for that. However, the majority of users which still uses the latest beta release won't get broken handlers that way.
Comment #35
steinmb commentedOK, thanks for all your hard work. I think most people are going to be very thankful for a patch that do not break every view on their site :)