Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doctrine provider #110

Merged
merged 32 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7fa6df9
Initial commit Doctrine provider
stevenjbrookes Aug 20, 2016
ad432f6
Completed dependency injection
stevenjbrookes Aug 20, 2016
3c85674
Fix missing use
stevenjbrookes Aug 20, 2016
1d289a5
Fix missing use
stevenjbrookes Aug 20, 2016
8357cb7
Add message length
stevenjbrookes Aug 20, 2016
8afdec1
Add indexes
stevenjbrookes Aug 20, 2016
83aa2ae
Add destroy functionality
stevenjbrookes Aug 21, 2016
95ab8c9
Fix query buildier calls
stevenjbrookes Aug 21, 2016
9f96206
Fix query buildier calls
stevenjbrookes Aug 21, 2016
1884ade
Tidy up
stevenjbrookes Aug 22, 2016
dd3eb3d
Added requires and suggestions
stevenjbrookes Aug 22, 2016
33006ac
Remove duplicated function
stevenjbrookes Aug 22, 2016
b5a87d1
Receive sort by ID
stevenjbrookes Aug 31, 2016
a717c19
Add functions getById and findBy
stevenjbrookes Sep 1, 2016
df94945
Fix null test
stevenjbrookes Sep 1, 2016
8fdd2d9
Change query alias to p
stevenjbrookes Sep 1, 2016
64425b8
Fixed typo
stevenjbrookes Sep 2, 2016
676b030
Fix FindBy call wildcards
Gnilya Sep 5, 2016
9b5bd80
fix findby to and from dates
Gnilya Sep 5, 2016
94649b1
order by id desc
Gnilya Sep 5, 2016
4803f35
remove sort
Gnilya Sep 5, 2016
c58279e
Add copyright
stevenjbrookes Sep 8, 2016
27f08f6
Add index for created column
stevenjbrookes Sep 8, 2016
f194aeb
fixed typo
stevenjbrookes Sep 8, 2016
47a75ee
Tidy up code and implement create function
stevenjbrookes Sep 9, 2016
13541fa
Merge branch 'doctrine-provider' of https://github.com/talisman-innov…
Gnilya Sep 13, 2016
8ae2908
Extend findBy to take a field name
Gnilya Sep 13, 2016
7b9b3fa
Extend findBy pass data in as an array
Gnilya Sep 14, 2016
def4ace
Extend findBy no need to check for
Gnilya Sep 15, 2016
d707fcb
Add function to returns conuts over a period
stevenjbrookes Nov 16, 2016
9f0b8c1
Fix typo
stevenjbrookes Nov 16, 2016
2f0fafc
Search between datetimes
Gnilya Jan 4, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/docs/_build
/coverage
.idea
/nbproject
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@
"aws/aws-sdk-php": "~2.5",
"iron-io/iron_mq": "^4.0",
"symfony/finder": "~2.3|^3.0",
"symfony/filesystem": "~2.3|^3.0"
"symfony/filesystem": "~2.3|^3.0",
"doctrine/orm": "^2.4.8",
"stof/doctrine-extensions-bundle": "^1.2"
},
"suggest": {
"aws/aws-sdk-php": "Required to use AWS as a Queue Provider",
"iron-io/iron_mq": "Required to use IronMQ as a Queue Provider",
"symfony/finder": "Required to use File as a Queue Provider",
"symfony/filesystem": "Required to use File as a Queue Provider"
"symfony/filesystem": "Required to use File as a Queue Provider",
"doctrine/orm": "Required to use Doctrine as a Queue Provider",
"stof/doctrine-extensions-bundle": "Required to use Doctrine as a Queue Provider"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 6 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ private function getProvidersNode()
'ironmq' => ['token', 'project_id'],
'sync' => [],
'custom' => ['service'],
'file' => ['path']
'file' => ['path'],
'doctrine' => []
];

$node
Expand Down Expand Up @@ -98,6 +99,10 @@ private function getProvidersNode()
->end()
// File
->scalarNode('path')->end()
// Doctrine
->scalarNode('entity_manager')
->defaultValue('doctrine.orm.default_entity_manager')
->end()
->end()

->validate()
Expand Down
9 changes: 9 additions & 0 deletions src/DependencyInjection/UecodeQPushExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public function load(array $configs, ContainerBuilder $container)
$class = $container->getParameter('uecode_qpush.provider.file');
$values['options']['path'] = $config['providers'][$provider]['path'];
break;
case 'doctrine':
$class = $container->getParameter('uecode_qpush.provider.doctrine');
$client = $this->createDoctrineClient($config['providers'][$provider]);
break;
}

$definition = new Definition(
Expand Down Expand Up @@ -236,6 +240,11 @@ private function createSyncClient()
{
return new Reference('event_dispatcher');
}

private function createDoctrineClient($config)
{
return new Reference($config['entity_manager']);
}

/**
* @param string $serviceId
Expand Down
236 changes: 236 additions & 0 deletions src/Entity/DoctrineMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
<?php

/**
* Copyright Talisman Innovations Ltd. (2016). All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package qpush-bundle
* @copyright Talisman Innovations Ltd. (2016)
* @license Apache License, Version 2.0
*/

namespace Uecode\Bundle\QPushBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Index as Index;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\Entity
* @ORM\Table(name="uecode_qpush_message",
* indexes={@ORM\Index(name="uecode_qpush_queue_idx",columns={"queue"}),
* @ORM\Index(name="uecode_qpush_delivered_idx",columns={"delivered"}),
* @ORM\Index(name="uecode_qpush_created_idx",columns={"created"})})
*/
class DoctrineMessage {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;

/**
* @var \DateTime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
private $created;

/**
* @var \DateTime $updated
*
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
private $updated;

/**
*
* @ORM\Column(type="string")
*/
private $queue;

/**
*
* @ORM\Column(type="boolean")
*/
private $delivered;

/**
*
* @ORM\Column(type="array")
*/
private $message;

/**
* @ORM\Column(type="integer")
*/
private $length;

/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}

/**
* Set message
*
* @param array $message
*
* @return DoctrineMessage
*/
public function setMessage($message)
{
$this->message = $message;

return $this;
}

/**
* Get message
*
* @return array
*/
public function getMessage()
{
return $this->message;
}

/**
* Set queue
*
* @param string $queue
*
* @return DoctrineMessage
*/
public function setQueue($queue)
{
$this->queue = $queue;

return $this;
}

/**
* Get queue
*
* @return string
*/
public function getQueue()
{
return $this->queue;
}

/**
* Set delivered
*
* @param boolean $delivered
*
* @return DoctrineMessage
*/
public function setDelivered($delivered)
{
$this->delivered = $delivered;

return $this;
}

/**
* Get delivered
*
* @return boolean
*/
public function getDelivered()
{
return $this->delivered;
}

/**
* Set created
*
* @param \DateTime $created
*
* @return DoctrineMessage
*/
public function setCreated($created)
{
$this->created = $created;

return $this;
}

/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}

/**
* Set updated
*
* @param \DateTime $updated
*
* @return DoctrineMessage
*/
public function setUpdated($updated)
{
$this->updated = $updated;

return $this;
}

/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}

/**
* Set length
*
* @param integer $length
*
* @return DoctrineMessage
*/
public function setLength($length)
{
$this->length = $length;

return $this;
}

/**
* Get length
*
* @return integer
*/
public function getLength()
{
return $this->length;
}
}
Loading