UnionOfRAD/lithium — pull request #575 by jails (2012-07-13 11:36:34+00:00)
Title: Implementing Model::relationships()

Currently relation names are "Inflectorized" in datas, i.e. if you have the following relation : "Post HasMany Comment" the comment's data are available using :

$entity->comments

`comments` is the fieldname associated to the "Comment" relation but there's no way to reach the relation name without iterating over all Model's relations.

`Model::relationship()` allow here to get back to the relation name.

echo Model::relationship('comments') // => 'Comment'

PS:
This will help to support the following syntax in the next futur :

$entity->comments = array(
array('body' => 'comment1'),
array('body' => 'comment1')
)