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

Incoming relations must be checked with both contenttype and id. #5637

Merged
merged 1 commit into from
Aug 6, 2016
Merged

Incoming relations must be checked with both contenttype and id. #5637

merged 1 commit into from
Aug 6, 2016

Conversation

SvanteRichter
Copy link
Contributor

Fixes part of #5636, where intra-contenttype relations will show as related to themselves.

@@ -190,7 +190,7 @@ public function getField($fieldname, $biDirectional = false)
public function incoming($entity)
{
return $this->filter(function ($el) use ($entity) {
return $el->getTo_contenttype() == (string) $entity->getContenttype();
return ($el->getTo_contenttype() == (string) $entity->getContenttype() && $el->getTo_id() == $entity->getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we need loose comparison?

Also the outer () isn't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, in this case strict should be fine. Also removed the outer parens.

@GwendolenLynch GwendolenLynch merged commit 5fe8357 into bolt:release/3.0 Aug 6, 2016
@SvanteRichter SvanteRichter deleted the incomming-relation-fix branch August 9, 2016 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants