Skip to content

[RFC] Simplifying the mapper layer #559

@adamlundrigan

Description

@adamlundrigan

The AbstractDbMapper provided by ZfcBase, and by extension ZfcUser's UserMapper, duplicate a ton of work that can easily be handed off to ZF2's built-in TableGateway system.

  • Building and executing SQL queries
  • Hydrating result of select() calls
  • Master/Slave adapter support

Utilizing TableGateway would strip ZfcUser's mapper down from ~400 lines (including AbstractDbMapper) to ~125 and remove the hard dependency on ZfcBase\Mapper\AbstractDbMapper, leaving ZfcUser's mapper as a just a thin wrapper around TableGateway that provides convenience methods (findBy*) and extracts entities passed to insert/update/delete methods.

An initial prototype of the refactoring can be diffed here. The modifications build on the result of #554, so I will submit a PR for this changeset once that PR has been completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions