Pagelock fixes

This PR converts the pagelock module to doctrine2 (and therefore closes #1227) along with a number of other fixes, code tidying

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #1227
| Refs tickets  |
| License       | MIT
| Doc PR        |