3.0 fix btm marshaller

This fixes the bug https://github.com/cakephp/cakephp/pull/4237 was trying to fix, but adds support for composite keys and tests
I will change it so it does not use union, the original idea that I had where I needed the unions did not work