zendframework/zf2-tutorial — pull request #3 by mmoussa (2012-10-03 14:19:15+00:00)
Title: Refactored AlbumTable to accept a TableGateway instead of acting as one.

I've been working on incorporating Unit Testing into the [zf2 tutorial documentation](https://github.com/zendframework/zf2-documentation/pull/307) and ran into a wall when testing the AlbumTable class. I believe it makes more sense for the AlbumTable to accept a TableGateway argument rather than extend AbstractTableGateway.

From the docs:

> "The TableGateway concrete implementation simply adds a sensible constructor to the AbstractTableGateway class so that out-of-the-box, TableGateway does not need to be extended in order to be consumed and utilized to its fullest."

The original implementation of AlbumTable doesn't add any gateway-specific functionality (so, arguably, it violates SRP). Even if it did, that special logic could be implemented using the Features API. Also from the docs:

> "In addition, AbstractTableGateway also implements a 'Feature' API, that allows for expanding the behaviors of the base TableGateway implementation without having to extend the class with this new functionality."

I hope you'll agree and accept this Pull Request. See the [corresponding documentation Pull Request](https://github.com/zendframework/zf2-documentation/pull/356) for more info.

Thanks!