Class to generate concrete instances of Aura\SqlMapper_Bundle mapper and gateway classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @file PayerSource.php | |
| * | |
| * Returns the concrete instances of AbstractGateway and AbstractMapper | |
| * specific to the particular database table. | |
| */ | |
| namespace Clx\DataSources; | |
| use Aura\SqlMapper_Bundle\ObjectFactory; | |
| use Aura\SqlMapper_Bundle\Query\ConnectedQueryFactory; | |
| use Aura\SqlMapper_Bundle\Filter; | |
| class PayerSource extends AbstractPdoSource | |
| { | |
| public function myGateway(ConnectedQueryFactory $q) | |
| { | |
| $filter = new Filter(); | |
| return new PayerGateway($this->connectionLocator, $q, $filter); | |
| } | |
| public function myMapper() | |
| { | |
| $objectFactory = new ObjectFactory(); | |
| $filter = new Filter(); | |
| return new PayerMapper($this->gateway, $objectFactory, $filter); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The idea is to not have to write all the set-up code over and over for each table. Instead, just this small class, and the typically small mapper, gateway and object (entity) classes need to be written. Error and connection handling all come along in the abstract super class.