tuupola/php-activerecord — pull request #2 by tuupola (2013-09-30 14:17:19+00:00)
Title: Honor primary_key option in $belongs_to

Fixes #364 primary_key support when using [belongs_to](http://www.phpactiverecord.org/projects/main/wiki/Associations#belongs_to) relationship. With the following code:

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

var_dump(Car::find($id)->alarm);
```

generated query before the patch is:

```sql
SELECT * FROM `alarms` WHERE `id`='something' LIMIT 0,1
````

after the patch it will be:

```sql
SELECT * FROM `alarms` WHERE `slug`='something' LIMIT 0,1