Added option to specify custom key associations in STAT relations.

Fixes issue #2936

This PR adds the option to specify custom key associations in STAT relations using the syntax array('FK'=>'PK'). This is the same syntax as used by HAS_MANY relations to specify custom key associations. This is an extensions of the current functionality of STAT relation, no changes to previous STAT relation functionality or syntax have been made.