Closed (fixed)
Project:
Relation
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 May 2012 at 12:58 UTC
Updated:
23 May 2013 at 02:07 UTC
Jump to comment: Most recent file
Comments
Comment #1
chx commentedAgreed. If you would provide a patch with tests I would be happy to do this.
Comment #2
mikran commentedI will implement this, soon(ish)
Comment #3
derhasi commentedThat was great! Would be a nice alternative to field_collection, without the overhead of caring about parent node save & co.
Would like to help out.
Comment #4
steveoliver commentedmikran: I know you're probably busier than me, but do you have anything started you can post up? Maybe derhasi can run with it?
derhasi: can you provide a patch with tests as per #1?
Comment #5
mikran commentedThis somehow slipped. I don't have anything but the change itself is not a big thing. The interface will however require some adjustments
Comment #6
naught101 commented@steve 'needs work' is for issues that have partially completed patches.
Comment #7
hazah commentedI've a use case where the minimum arity of the relation needs to be 1. In my case I have a team (content) and a roster (relation) of team members (content) belonging to that team. I needed a directional relationship from team to roster, but a non directional one for the roster itself. This works great except for the minimum 2 arity set on the roster... It means I cannot create one without at least 2 team members, which makes adding the first member a challange. With the allowance of minimum arity of 1, this would not be a problem.
Comment #8
cdale commentedI've created a patch for this but I have a few questions.
I'm questioning the change in relation_get_related_entity(). I have no doubt that the related entity in an unary relation is the only entity in the relation, I'm just not sure if returning it is wise? Potential breakage if relation_get_related_entity() is used in a loop to loop over relations? Though, the same thing can happen without unary relations, so possibly a non-issue.
One thing that has come up in the tests, specifically this code:
This seems to return any relation that involves node5. In a way that makes sense, but I'm not sure if it's right or wrong. For the time being I've left this test as failing to await others feedback.
Are there any other tests that people would like to see?
Comment #9
cdale commentedComment #10
cdale commentedComment #11
cdale commentedThe more I thought about this, the less I felt it was needed to be able to query the "Other endpoint" in unary relations. In fact, it no longer made sense at all to me. Not to mention the way endpoints are stored, the only real way to tell if it's unary is to check the arity.
Attached is a patch that reflects this. There is in effect, no other endpoint. The code above will still return all endpoints that are node5, but relation_get_related_entity() will now return FALSE for unary relations.
Comment #12
mikran commentedThe patch looks really solid, thanks cdale.
Yeah, I agree.
Comment #13
mikran commentedcommitted
Comment #15
k.skarlatos commentedDoes this work? I have tried to use this feature with latest dev of relation and relation add, and although the relation and the fields are shown on the edit page, on save no relation is created. Also there are no error messages.
Comment #16
naught101 commented@Aegean_communication: Please open a separate bug report, with details on what you're doing, and a copy+paste of the error messages.