Returns true if a relationship was found between the two ids for the current RelationType.
When the RelationType has it's direction configured as a parent to child, the order of the parameters is significant (first is parent, second is child).
But it is not so. IsRelated returns wrong result for bidirectional relations. I checked the source code all the way up to version 7. In src/umbraco.cms/businesslogic/relation/Relation.csLine 141 says:
intcount=SqlHelper.ExecuteScalar<int>("SELECT count(*) FROM umbracoRelation WHERE childId = @childId AND parentId = @parentId",
IsRelated does not care for bidirectional relations
Like this page documents: http://our.umbraco.org/documentation/Reference/Querying/uQuery/Relations
IsRelated(int, int)
Returns:
bool
Returns true if a relationship was found between the two ids for the current RelationType.
When the RelationType has it's direction configured as a parent to child, the order of the parameters is significant (first is parent, second is child).
But it is not so. IsRelated returns wrong result for bidirectional relations. I checked the source code all the way up to version 7. In src/umbraco.cms/businesslogic/relation/Relation.cs Line 141 says:
int count = SqlHelper.ExecuteScalar<int>("SELECT count(*) FROM umbracoRelation WHERE childId = @childId AND parentId = @parentId",
... so I guess this is a known bug?
is working on a reply...