1 | <?php |
||
28 | class Observer extends Client |
||
29 | { |
||
30 | protected $channel; |
||
31 | |||
32 | /** |
||
33 | * __construct |
||
34 | * |
||
35 | * Constructor |
||
36 | * |
||
37 | * @param string $channel |
||
38 | */ |
||
39 | public function __construct($channel) |
||
43 | |||
44 | /** |
||
45 | * getClientType |
||
46 | * |
||
47 | * @see Client |
||
48 | */ |
||
49 | public function getClientType() |
||
53 | |||
54 | /** |
||
55 | * getClientIdentifier |
||
56 | * |
||
57 | * @see Client |
||
58 | */ |
||
59 | public function getClientIdentifier() |
||
63 | |||
64 | /** |
||
65 | * initialize |
||
66 | * |
||
67 | * @see Client |
||
68 | */ |
||
69 | public function initialize(Session $session) |
||
74 | |||
75 | /** |
||
76 | * shutdown |
||
77 | * |
||
78 | * @see Client |
||
79 | */ |
||
80 | public function shutdown() |
||
84 | |||
85 | /** |
||
86 | * getNotification |
||
87 | * |
||
88 | * Check if a notification is pending. If so, the payload is returned. |
||
89 | * Otherwise, null is returned. |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | public function getNotification() |
||
101 | |||
102 | /** |
||
103 | * restartListening |
||
104 | * |
||
105 | * Send a LISTEN command to the backend. This is called in the initialize() |
||
106 | * method but it can be unlisten if the listen command took place in a |
||
107 | * transaction. |
||
108 | * |
||
109 | * @return Observer $this |
||
110 | */ |
||
111 | public function restartListening() |
||
115 | |||
116 | /** |
||
117 | * listen |
||
118 | * |
||
119 | * Start to listen on the given channel. The observer automatically starts |
||
120 | * listening when registered against the session. |
||
121 | * NOTE: When listen is issued in a transaction it is unlisten when the |
||
122 | * transaction is committed or rollback. |
||
123 | * |
||
124 | * @param string $channel |
||
125 | * @return Observer $this |
||
126 | */ |
||
127 | protected function listen($channel) |
||
139 | |||
140 | /** |
||
141 | * unlisten |
||
142 | * |
||
143 | * Stop listening to events. |
||
144 | * |
||
145 | * @param string $channel |
||
146 | * @return Observer $this |
||
147 | * |
||
148 | */ |
||
149 | protected function unlisten($channel) |
||
160 | |||
161 | /** |
||
162 | * throwNotification |
||
163 | * |
||
164 | * Check if a notification is pending. If so, a NotificationException is thrown. |
||
165 | * |
||
166 | * @throws NotificationException |
||
167 | * @return Observer $this |
||
168 | */ |
||
169 | public function throwNotification() |
||
179 | |||
180 | /** |
||
181 | * executeAnonymousQuery |
||
182 | * |
||
183 | * Proxy for Connection::executeAnonymousQuery() |
||
184 | * |
||
185 | * @param string $sql |
||
186 | * @return Observer $this |
||
187 | * @see Connection |
||
188 | */ |
||
189 | protected function executeAnonymousQuery($sql) |
||
199 | |||
200 | /** |
||
201 | * escapeIdentifier |
||
202 | * |
||
203 | * Proxy for Connection::escapeIdentifier() |
||
204 | * |
||
205 | * @param string $string |
||
206 | * @return string |
||
207 | * @see Connection |
||
208 | */ |
||
209 | protected function escapeIdentifier($string) |
||
217 | } |
||
218 |