1 | <?php |
||
18 | class TableGateway extends AbstractTableGateway |
||
19 | { |
||
20 | private $config; |
||
21 | |||
22 | public function __construct($object) |
||
23 | { |
||
24 | $this->config = Reader::getConfig($object); |
||
25 | |||
26 | if (!array_key_exists('table', $this->config)) |
||
27 | throw new NoTableFoundException(); |
||
28 | |||
29 | $this->table = $this->config['table']; |
||
30 | |||
31 | if(!isset($this->config['adapter'])) |
||
32 | $this->config['adapter'] = 'Default'; |
||
33 | |||
34 | $adapterPool = new AdapterPool(); |
||
35 | $this->adapter = $adapterPool->get($this->config['adapter']); |
||
36 | |||
37 | $this->updateContext(); |
||
38 | |||
39 | $platform = $this->adapter->getPlatform()->getName(); |
||
40 | if(isset($this->config['schema']) && $platform == 'PostgreSQL'){ |
||
41 | $pk = $this->config['primary_key']; |
||
42 | $sq = $this->config['table'] . '_' . $pk . '_seq'; |
||
43 | |||
44 | $this->featureSet = new FeatureSet(); |
||
45 | $this->featureSet->addFeature(new SequenceFeature($pk, $sq)); |
||
46 | $this->initialize(); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | protected function updateContext() |
||
67 | } |
||
68 |