lox/pheasant — pull request #7 by lwc (2012-10-23 14:27:10+00:00)
Title: Added relationship caching

### Currently
```php
Contests));
// SELECT * FROM contest WHERE userid='99'
Spf::dump(iterator_to_array($developer->Contests));
// SELECT * FROM contest WHERE userid='99'
Spf::dump(iterator_to_array($developer->Contests));
// SELECT * FROM contest WHERE userid='99'

// BelongsTo
$contest = Contest::last();
// SELECT * FROM contest WHERE `listingid` = 167387
Spf::dump($contest->User);
// SELECT * FROM user WHERE userid='99'
Spf::dump($contest->User);
// SELECT * FROM user WHERE userid='99'
Spf::dump($contest->User);
// SELECT * FROM user WHERE userid='99'
```

### With this
```php
Contests));
// SELECT * FROM contest WHERE userid='99'
Spf::dump(iterator_to_array($developer->Contests));
Spf::dump(iterator_to_array($developer->Contests));

// BelongsTo
$contest = Contest::last();
// SELECT * FROM contest WHERE `listingid` = 167387
Spf::dump($contest->User);
// SELECT * FROM user WHERE userid='99'
Spf::dump($contest->User);
Spf::dump($contest->User);
```

### Implementation Quirk
Storing the InstanceCache on the domain object is not ideal, but there is only one Schema for all instances of a DomainObject and therefore only one instance per property of Relationships.