1 | <?php |
||
21 | abstract class AbstractTable |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $name; |
||
27 | |||
28 | /** |
||
29 | * @var Adapter |
||
30 | */ |
||
31 | protected $adapter; |
||
32 | |||
33 | /** |
||
34 | * @var bool|null |
||
35 | */ |
||
36 | protected $view; |
||
37 | |||
38 | /** |
||
39 | * @param string $name |
||
40 | */ |
||
41 | public function __construct($name, Adapter $adapter) |
||
42 | { |
||
43 | $this->adapter = $adapter; |
||
44 | $this->setName($name); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return \Zend\Db\ResultSet\ResultSet |
||
49 | */ |
||
50 | abstract protected function showCreate(); |
||
51 | |||
52 | /** |
||
53 | * @return \Zend\Db\ResultSet\ResultSet |
||
54 | */ |
||
55 | abstract protected function showColumns(); |
||
56 | |||
57 | /** |
||
58 | * @return \Zend\Db\ResultSet\ResultSet |
||
59 | */ |
||
60 | abstract protected function select(); |
||
61 | |||
62 | /** |
||
63 | * @return ColumnsInterface |
||
64 | */ |
||
65 | abstract protected function createColumns(); |
||
66 | |||
67 | /** |
||
68 | * @return ExtraInterface[] |
||
69 | */ |
||
70 | abstract protected function createExtras(); |
||
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | */ |
||
75 | abstract protected function create(); |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | abstract protected function startInsert(); |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | abstract protected function continueInsert(); |
||
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | abstract protected function finishInsert(); |
||
91 | |||
92 | /** |
||
93 | * @param string $name |
||
94 | * @return $this |
||
95 | */ |
||
96 | protected function setName($name) |
||
101 | |||
102 | /** |
||
103 | * @return bool |
||
104 | * @throws Exception\RuntimeException |
||
105 | */ |
||
106 | protected function isView() |
||
107 | { |
||
108 | if (null === $this->view) { |
||
109 | throw new Exception\RuntimeException('Don\'t know if is view'); |
||
110 | } |
||
111 | |||
112 | return $this->view; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @param bool $view |
||
117 | * @return $this |
||
118 | */ |
||
119 | protected function setView($view) |
||
124 | |||
125 | /** |
||
126 | * @return \Zend\Db\Adapter\Platform\PlatformInterface |
||
127 | */ |
||
128 | protected function getPlatform() |
||
132 | |||
133 | /** |
||
134 | * @param File $file |
||
135 | * @return $this |
||
136 | */ |
||
137 | public function write(File $file) |
||
148 | |||
149 | /** |
||
150 | * @param File $file |
||
151 | * @return $this |
||
152 | */ |
||
153 | private function writeData(File $file) |
||
189 | |||
190 | /** |
||
191 | * @return ColumnsInterface |
||
192 | */ |
||
193 | private function createColumnsInternal() |
||
202 | } |
||
203 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: