kla/php-activerecord — pull request #253 by anther (2013-01-29 17:41:41+00:00)
Title: Simple fix for nested relationships

I posted this as a question on Stackoverflow about a half year ago, and was suggested a fix that I've been using since then, and feel it'd be appropriate for the fix to be included in the base repo. http://stackoverflow.com/questions/9983803/triple-level-associations-in-phpactiverecord

Essentially if you go down to a third level of eager loaded associations
```
$criteria['include'] = array('playlist_songs'=>array('song'=>array('album')));
//or
$criteria['include'] = array('events'=>array('host'=>array('events')));
```
You'd end up with this error instead of the requested data: ```Undefined offset: 0```

The problem was traced to the ```Table::execute_eager_load()```
at line 257: ```$nested_includes = count($name) > 1 ? $name : $name[0];```

Which is essentially saying, if the array is 2 or more, return the first element, but if the count is equal to 1, don't treat it as an array, even though it still is an array at that point.

I added a test to RelationshipTest.php that fails before the change.