Revision table has a uid, but not the base table.
This means property queries using EFQ against contact owner fail (uid).
Proposed solution: nothing crazy, just add uid to the schema, add an update function and ensure the entity controller is using it correctly.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | crm_core-fix_missing_uid_on_contact_table-1914326-1.patch | 1.7 KB | pingers |
Comments
Comment #1
pingers commentedShouldn't be too much more than this patch... reviews welcome.
Comment #2
rosk0Looks like this issue is bigger that seems at first glance.
Description of crm_core_contact_revision.uid said: "The users.uid that created this version.". But it stores UID of user that create the contact OR UID of user associated with contact. That's not all - there is no revisions of contacts. The revisions table is just an extended version of base table. I've also discovered that there is some bugs it saving created/changed timestamps, but have no time to collect more info. All of this probably should be decomposed to several issues, but I really have no time for it right now.
Comment #3
pingers commentedThese have little do with this issue... they're just things you noticed while looking at it. Please open issues as appropriate.
Comment #4
pingers commented"Description of crm_core_contact_revision.uid said: "The users.uid that created this version.". But it stores UID of user that create the contact OR UID of user associated with contact."
- What makes you think the role of uid column is shared? I.e. there's a relation to handle user->contact relationship. This is ONLY about which user created/updated the contact.
"That's not all - there is no revisions of contacts. The revisions table is just an extended version of base table."
- Yes, we have not enabled revisions, but entity api supports revisions. You should just need to set $entity->is_new_revision when saving a contact to create a revision. Haven't tried it though.
"I've also discovered that there is some bugs it saving created/changed timestamps, but have no time to collect more info. All of this probably should be decomposed to several issues, but I really have no time for it right now."
- Okay, so let's figure out if this is a real bug when we get time.
Comment #5
dealancer commentedThe solution looks good.
I would prefer to test it when creating new contacts. Need to make sure uid field is populated correctly.
Comment #6
pingers commentedPlease do :)
Comment #7
dealancer commentedGood work: update and new contact creating works well.
Comment #8
pingers commentedCommitted in 84aa361
Comment #9
Anonymous (not verified) commentedwh00t!