Pass the connection to mocked models.

This fixes issues with partial mocks where functions needing the
connection would fail.

Refs #4113
Make table bake template simpler fixing incorrect semi-colon.

By cleaning up the bake template to use implode() we can avoid any and
all incorrectly positioned semi-colons.

Refs #4143
Merge pull request #4153 from markstory/issue-4113

Fix a few issues