kla/php-activerecord — pull request #368 by tuupola (2013-10-14 19:04:43+00:00)
Title: Honor primary_key option in $has_many when eager loading.

Fixes #366 primary_key support when using has_many relationship and eager loading. With the following code:

With the following code:

```php
class Car extends ActiveRecord\Model {
static $has_many = array(
array("residual_values", "foreign_key" => "slug", "primary_key" => "slug")
);
}

$foo = Car::find($id)->residual_values;

$bar = Car::find($id, array(
"include" => array("residual_values")
));
```

generated query before the patch is:

```sql
SELECT * FROM `residual_values` WHERE `slug`='something'
SELECT * FROM `residual_values` WHERE `slug` IN(119)
````

after the patch it will be:

```sql
SELECT * FROM `residual_values` WHERE `slug`='something'
SELECT * FROM `residual_values` WHERE `slug`='something'
```