| 1 | <?php |
||
| 4 | class PdoAddressFactory |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * @var AddressFactory |
||
| 8 | */ |
||
| 9 | public $address_factory; |
||
|
|
|||
| 10 | |||
| 11 | /** |
||
| 12 | * @var PDOStmt |
||
| 13 | */ |
||
| 14 | public $stmt; |
||
| 15 | |||
| 16 | public static $DB_FIELDS = array( |
||
| 17 | 'id', |
||
| 18 | 'type', |
||
| 19 | 'street1', |
||
| 20 | 'street2', |
||
| 21 | 'zip', |
||
| 22 | 'location', |
||
| 23 | 'country' |
||
| 24 | ); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param \PDO $pdo |
||
| 28 | * @param string $table_name |
||
| 29 | * @param AddressFactory|null $address_factory |
||
| 30 | */ |
||
| 31 | 8 | public function __construct( \PDO $pdo, string $table_name, AddressFactory $address_factory = null ) |
|
| 42 | |||
| 43 | |||
| 44 | 6 | public function __invoke( int $id ) : AddressInterface |
|
| 51 | } |