jpfuentes2/php-activerecord — pull request #399 by nguyenbathanh (2014-02-11 08:08:53+00:00)
Title: Avoid duplicate foreign_key values when do eager loading (preloading)

Example:

$posts = Post::all(array('include' => array('author'));

foreach($posts as $post){
echo $post->author->name;
}

After loading the posts, It will collect the *author_id* from each one and load all the referenced authors with one query.

But some posts may have the same *author_id* so we should avoid them being duplicated (in select query).