Skip to content

Commit 35de689

Browse files
author
Keith Kirk
committed
Fixes merge conflicts
2 parents fc1bf99 + 2f0fafc commit 35de689

7 files changed

Lines changed: 560 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/docs/_build
44
/coverage
55
.idea
6+
/nbproject

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@
3131
"symfony/finder": "~2.3|^3.0",
3232
"symfony/filesystem": "~2.3|^3.0",
3333
"symfony/phpunit-bridge": "^4.0",
34-
"symfony/yaml": "~2.8|^3.0"
34+
"symfony/yaml": "~2.8|^3.0",
35+
"doctrine/orm": "^2.4.8",
36+
"stof/doctrine-extensions-bundle": "^1.2"
3537
},
3638
"suggest": {
3739
"aws/aws-sdk-php": "Required to use AWS as a Queue Provider",
3840
"iron-io/iron_mq": "Required to use IronMQ as a Queue Provider",
3941
"symfony/finder": "Required to use File as a Queue Provider",
40-
"symfony/filesystem": "Required to use File as a Queue Provider"
42+
"symfony/filesystem": "Required to use File as a Queue Provider",
43+
"doctrine/orm": "Required to use Doctrine as a Queue Provider",
44+
"stof/doctrine-extensions-bundle": "Required to use Doctrine as a Queue Provider"
4145
},
4246
"autoload": {
4347
"psr-4": {

src/DependencyInjection/Configuration.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ private function getProvidersNode()
6161
'ironmq' => ['token', 'project_id'],
6262
'sync' => [],
6363
'custom' => ['service'],
64-
'file' => ['path']
64+
'file' => ['path'],
65+
'doctrine' => []
6566
];
6667

6768
$node
@@ -98,6 +99,10 @@ private function getProvidersNode()
9899
->end()
99100
// File
100101
->scalarNode('path')->end()
102+
// Doctrine
103+
->scalarNode('entity_manager')
104+
->defaultValue('doctrine.orm.default_entity_manager')
105+
->end()
101106
->end()
102107

103108
->validate()

src/DependencyInjection/UecodeQPushExtension.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ public function load(array $configs, ContainerBuilder $container)
9898
$class = $container->getParameter('uecode_qpush.provider.file');
9999
$values['options']['path'] = $config['providers'][$provider]['path'];
100100
break;
101+
case 'doctrine':
102+
$class = $container->getParameter('uecode_qpush.provider.doctrine');
103+
$client = $this->createDoctrineClient($config['providers'][$provider]);
104+
break;
101105
}
102106

103107
$definition = new Definition(
@@ -256,6 +260,11 @@ private function createSyncClient()
256260
{
257261
return new Reference('event_dispatcher');
258262
}
263+
264+
private function createDoctrineClient($config)
265+
{
266+
return new Reference($config['entity_manager']);
267+
}
259268

260269
/**
261270
* @param string $serviceId

src/Entity/DoctrineMessage.php

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
<?php
2+
3+
/**
4+
* Copyright Talisman Innovations Ltd. (2016). All rights reserved
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* @package qpush-bundle
19+
* @copyright Talisman Innovations Ltd. (2016)
20+
* @license Apache License, Version 2.0
21+
*/
22+
23+
namespace Uecode\Bundle\QPushBundle\Entity;
24+
25+
use Doctrine\ORM\Mapping as ORM;
26+
use Doctrine\ORM\Mapping\Index as Index;
27+
use Gedmo\Mapping\Annotation as Gedmo;
28+
29+
/**
30+
* @ORM\Entity
31+
* @ORM\Table(name="uecode_qpush_message",
32+
* indexes={@ORM\Index(name="uecode_qpush_queue_idx",columns={"queue"}),
33+
* @ORM\Index(name="uecode_qpush_delivered_idx",columns={"delivered"}),
34+
* @ORM\Index(name="uecode_qpush_created_idx",columns={"created"})})
35+
*/
36+
class DoctrineMessage {
37+
/**
38+
* @ORM\Id
39+
* @ORM\GeneratedValue
40+
* @ORM\Column(type="integer")
41+
*/
42+
private $id;
43+
44+
/**
45+
* @var \DateTime $created
46+
*
47+
* @Gedmo\Timestampable(on="create")
48+
* @ORM\Column(type="datetime")
49+
*/
50+
private $created;
51+
52+
/**
53+
* @var \DateTime $updated
54+
*
55+
* @Gedmo\Timestampable(on="update")
56+
* @ORM\Column(type="datetime")
57+
*/
58+
private $updated;
59+
60+
/**
61+
*
62+
* @ORM\Column(type="string")
63+
*/
64+
private $queue;
65+
66+
/**
67+
*
68+
* @ORM\Column(type="boolean")
69+
*/
70+
private $delivered;
71+
72+
/**
73+
*
74+
* @ORM\Column(type="array")
75+
*/
76+
private $message;
77+
78+
/**
79+
* @ORM\Column(type="integer")
80+
*/
81+
private $length;
82+
83+
/**
84+
* Get id
85+
*
86+
* @return integer
87+
*/
88+
public function getId()
89+
{
90+
return $this->id;
91+
}
92+
93+
/**
94+
* Set message
95+
*
96+
* @param array $message
97+
*
98+
* @return DoctrineMessage
99+
*/
100+
public function setMessage($message)
101+
{
102+
$this->message = $message;
103+
104+
return $this;
105+
}
106+
107+
/**
108+
* Get message
109+
*
110+
* @return array
111+
*/
112+
public function getMessage()
113+
{
114+
return $this->message;
115+
}
116+
117+
/**
118+
* Set queue
119+
*
120+
* @param string $queue
121+
*
122+
* @return DoctrineMessage
123+
*/
124+
public function setQueue($queue)
125+
{
126+
$this->queue = $queue;
127+
128+
return $this;
129+
}
130+
131+
/**
132+
* Get queue
133+
*
134+
* @return string
135+
*/
136+
public function getQueue()
137+
{
138+
return $this->queue;
139+
}
140+
141+
/**
142+
* Set delivered
143+
*
144+
* @param boolean $delivered
145+
*
146+
* @return DoctrineMessage
147+
*/
148+
public function setDelivered($delivered)
149+
{
150+
$this->delivered = $delivered;
151+
152+
return $this;
153+
}
154+
155+
/**
156+
* Get delivered
157+
*
158+
* @return boolean
159+
*/
160+
public function getDelivered()
161+
{
162+
return $this->delivered;
163+
}
164+
165+
/**
166+
* Set created
167+
*
168+
* @param \DateTime $created
169+
*
170+
* @return DoctrineMessage
171+
*/
172+
public function setCreated($created)
173+
{
174+
$this->created = $created;
175+
176+
return $this;
177+
}
178+
179+
/**
180+
* Get created
181+
*
182+
* @return \DateTime
183+
*/
184+
public function getCreated()
185+
{
186+
return $this->created;
187+
}
188+
189+
/**
190+
* Set updated
191+
*
192+
* @param \DateTime $updated
193+
*
194+
* @return DoctrineMessage
195+
*/
196+
public function setUpdated($updated)
197+
{
198+
$this->updated = $updated;
199+
200+
return $this;
201+
}
202+
203+
/**
204+
* Get updated
205+
*
206+
* @return \DateTime
207+
*/
208+
public function getUpdated()
209+
{
210+
return $this->updated;
211+
}
212+
213+
/**
214+
* Set length
215+
*
216+
* @param integer $length
217+
*
218+
* @return DoctrineMessage
219+
*/
220+
public function setLength($length)
221+
{
222+
$this->length = $length;
223+
224+
return $this;
225+
}
226+
227+
/**
228+
* Get length
229+
*
230+
* @return integer
231+
*/
232+
public function getLength()
233+
{
234+
return $this->length;
235+
}
236+
}

0 commit comments

Comments
 (0)