1 | <?php |
||
30 | class DoctrineProvider extends AbstractProvider |
||
31 | { |
||
32 | |||
33 | protected $em; |
||
34 | protected $repository; |
||
35 | protected static $entityName = 'Uecode\Bundle\QPushBundle\Entity\DoctrineMessage'; |
||
36 | |||
37 | /** |
||
38 | * Constructor for Provider classes |
||
39 | * |
||
40 | * @param string $name Name of the Queue the provider is for |
||
41 | * @param array $options An array of configuration options for the Queue |
||
42 | * @param mixed $client A Queue Client for the provider |
||
43 | * @param Cache $cache An instance of Doctrine\Common\Cache\Cache |
||
44 | * @param Logger $logger An instance of Symfony\Bridge\Mongolog\Logger |
||
45 | */ |
||
46 | public function __construct($name, array $options, $client, Cache $cache, Logger $logger) |
||
55 | |||
56 | /** |
||
57 | * Returns the name of the Queue that this Provider is for |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getName() |
||
65 | |||
66 | /** |
||
67 | * Returns the Queue Provider name |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getProvider() |
||
75 | |||
76 | /** |
||
77 | * Returns the Provider's Configuration Options |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function getOptions() |
||
85 | |||
86 | /** |
||
87 | * Returns the Cache service |
||
88 | * |
||
89 | * @return Cache |
||
90 | */ |
||
91 | public function getCache() |
||
95 | |||
96 | /** |
||
97 | * Returns the Logger service |
||
98 | * |
||
99 | * @return Logger |
||
100 | */ |
||
101 | public function getLogger() |
||
105 | |||
106 | /** |
||
107 | * Get repository |
||
108 | * |
||
109 | * @return array |
||
110 | */ |
||
111 | public function getRepository() |
||
119 | |||
120 | /** |
||
121 | * Creates the Queue |
||
122 | * Checks to see if the underlying table has been created or not |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function create() |
||
133 | |||
134 | /** |
||
135 | * Publishes a message to the Queue |
||
136 | * |
||
137 | * This method should return a string MessageId or Response |
||
138 | * |
||
139 | * @param array $message The message to queue |
||
140 | * @param array $options An array of options that override the queue defaults |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | public function publish(array $message, array $options = []) |
||
161 | |||
162 | /** |
||
163 | * Polls the Queue for Messages |
||
164 | * |
||
165 | * Depending on the Provider, this method may keep the connection open for |
||
166 | * a configurable amount of time, to allow for long polling. In most cases, |
||
167 | * this method is not meant to be used to long poll indefinitely, but should |
||
168 | * return in reasonable amount of time |
||
169 | * |
||
170 | * @param array $options An array of options that override the queue defaults |
||
171 | * |
||
172 | * @return array |
||
173 | */ |
||
174 | public function receive(array $options = []) |
||
194 | |||
195 | /** |
||
196 | * Deletes the Queue Message |
||
197 | * |
||
198 | * @param mixed $id A message identifier or resource |
||
199 | */ |
||
200 | public function delete($id) |
||
208 | |||
209 | /** |
||
210 | * Destroys a Queue and clears any Queue related Cache |
||
211 | * |
||
212 | * @return bool |
||
213 | */ |
||
214 | public function destroy() |
||
224 | |||
225 | /** |
||
226 | * Returns a specific message |
||
227 | * |
||
228 | * @param integer $id |
||
229 | * |
||
230 | * @return Message |
||
231 | */ |
||
232 | public function getById($id) |
||
236 | |||
237 | /* |
||
238 | * Returns a query of the message queue |
||
239 | * |
||
240 | * @param string $contains |
||
241 | * @param DateTime $from |
||
242 | * @param DateTime $to |
||
243 | * |
||
244 | * @return Query |
||
245 | */ |
||
246 | |||
247 | public function findBy($contains = null, $from = null, $to = null) |
||
272 | } |
||
273 |