1 | <?php |
||
28 | class Observer extends Client |
||
29 | { |
||
30 | protected $channel; |
||
31 | |||
32 | /** |
||
33 | * __construct |
||
34 | * |
||
35 | * Constructor |
||
36 | * |
||
37 | * @access public |
||
38 | * @param string $channel |
||
39 | */ |
||
40 | public function __construct($channel) |
||
44 | |||
45 | /** |
||
46 | * getClientType |
||
47 | * |
||
48 | * @see Client |
||
49 | */ |
||
50 | public function getClientType() |
||
54 | |||
55 | /** |
||
56 | * getClientIdentifier |
||
57 | * |
||
58 | * @see Client |
||
59 | */ |
||
60 | public function getClientIdentifier() |
||
64 | |||
65 | /** |
||
66 | * initialize |
||
67 | * |
||
68 | * @see Client |
||
69 | */ |
||
70 | public function initialize(Session $session) |
||
75 | |||
76 | /** |
||
77 | * shutdown |
||
78 | * |
||
79 | * @see Client |
||
80 | */ |
||
81 | public function shutdown() |
||
85 | |||
86 | /** |
||
87 | * getNotification |
||
88 | * |
||
89 | * Check if a notification is pending. If so, the payload is returned. |
||
90 | * Otherwise, null is returned. |
||
91 | * |
||
92 | * @access public |
||
93 | * @return array |
||
94 | */ |
||
95 | public function getNotification() |
||
103 | |||
104 | /** |
||
105 | * restartListening |
||
106 | * |
||
107 | * Send a LISTEN command to the backend. This is called in the initialize() |
||
108 | * method but it can be unlisten if the listen command took place in a |
||
109 | * transaction. |
||
110 | * |
||
111 | * @access public |
||
112 | * @return Observer $this |
||
113 | */ |
||
114 | public function restartListening() |
||
118 | |||
119 | /** |
||
120 | * listen |
||
121 | * |
||
122 | * Start to listen on the given channel. The observer automatically starts |
||
123 | * listening when registered against the session. |
||
124 | * NOTE: When listen is issued in a transaction it is unlisten when the |
||
125 | * transaction is committed or rollback. |
||
126 | * |
||
127 | * @access protected |
||
128 | * @param string $channel |
||
129 | * @return Observer $this |
||
130 | */ |
||
131 | protected function listen($channel) |
||
143 | |||
144 | /** |
||
145 | * unlisten |
||
146 | * |
||
147 | * Stop listening to events. |
||
148 | * |
||
149 | * @access protected |
||
150 | * @param string $channel |
||
151 | * @return Observer $this |
||
152 | * |
||
153 | */ |
||
154 | protected function unlisten($channel) |
||
165 | |||
166 | /** |
||
167 | * throwNotification |
||
168 | * |
||
169 | * Check if a notification is pending. If so, a NotificationException is thrown. |
||
170 | * |
||
171 | * @access public |
||
172 | * @throws NotificationException |
||
173 | * @return Observer $this |
||
174 | */ |
||
175 | public function throwNotification() |
||
185 | |||
186 | /** |
||
187 | * executeAnonymousQuery |
||
188 | * |
||
189 | * Proxy for Connection::executeAnonymousQuery() |
||
190 | * |
||
191 | * @access protected |
||
192 | * @param string $sql |
||
193 | * @return Observer $this |
||
194 | * @see Connection |
||
195 | */ |
||
196 | protected function executeAnonymousQuery($sql) |
||
206 | |||
207 | /** |
||
208 | * escapeIdentifier |
||
209 | * |
||
210 | * Proxy for Connection::escapeIdentifier() |
||
211 | * |
||
212 | * @access protected |
||
213 | * @param string $string |
||
214 | * @return string |
||
215 | * @see Connection |
||
216 | */ |
||
217 | protected function escapeIdentifier($string) |
||
225 | } |
||
226 |