1: <?php
2:
3: namespace malkusch\bav;
4:
5: /**
6: * Container for PDODataBackend objects.
7: *
8: * @author Markus Malkusch <markus@malkusch.de>
9: * @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations
10: * @license GPL
11: * @see DataBackend
12: * @api
13: */
14: class PDODataBackendContainer extends DataBackendContainer
15: {
16:
17: /**
18: * @var \PDO
19: */
20: private $pdo;
21:
22: /**
23: * @var string
24: */
25: private $prefix;
26:
27: /**
28: * Sets the PDO and the table prefix.
29: *
30: * @param String $prefix the prefix of the table names. Default is 'bav_'.
31: */
32: public function __construct(\PDO $pdo, $prefix = 'bav_')
33: {
34: $this->pdo = $pdo;
35: $this->prefix = $prefix;
36: }
37:
38: /**
39: * Returns the unconfigured backend which is only created by calling the
40: * constructor.
41: *
42: * @return PDODataBackend
43: */
44: protected function makeDataBackend()
45: {
46: return new PDODataBackend($this->pdo, $this->prefix);
47: }
48: }
49: