Flush TableRegistry when generating controllers/models.

Because tests will attach any and all associations, we need to flush the registry in all() commands. This flushes out belongsToMany associations that have also generated hasMany associations to their parent tables.

Refs #4143