Skip to content

Fixes bug if there are duplicate posts in items array #7

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajoah
Copy link

@ajoah ajoah commented Jan 3, 2017

Hi,

If i try to connect posts from array which contains same post multiple time, only the first post is connected.

Exemple :

$posts = [
object(WP_Post) { 
 ['ID'] => 1,
 [...]
},
object(WP_Post) { 
 ['ID'] => 1,
 [...]
}
]
p2p_type( 'movies_to_actors' )->each_connected( $posts, array(), 'actors' );

var_dump($posts)  => [
object(WP_Post) { 
 ['ID'] => 1,
 ['actors'] => [...]
 [...]
},
object(WP_Post) { 
 ['ID'] => 1,
 [...]
}
]

The second post should have an actors attribute.

This pull request fixes this bug.

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.

1 participant