
Description
Hi
I'm trying to write a custom provider which uses a DB via Doctrine to queue and persist the messages. I've run some tests using the sync driver which works fine. I've now implemented the beginning of the custom provider by implementing ProviderInterface. However when I try to use the new custom queue I get the following message
Warning: Missing argument 1 for AppBundle\QPush\DoctrineProvider::__construct(), called in /Users/sbrookes/Development/symfony/app/cache/dev/appDevDebugProjectContainer.php on line 1839 and defined
As if the customer provider isn't calling the constructor with any arguments.
Any ideas or some working code that implements a custom provider I can work from?
Thanks
Steve
Section from config.yml
uecode_qpush:
providers:
in_band:
driver: sync
file_based:
driver: file
path: %kernel.root_dir%/tmp
custom_provider:
driver: custom
service: qpush.doctrine
queues:
tide_queue:
provider: file_based
options:
message_delay: 0
push_notifications: true
messages_to_receive: 100
tide_queue1:
provider: custom_provider
Services.yml
services:
qpush.doctrine:
class: AppBundle\QPush\DoctrineProvider
DoctrineProvider.php
namespace AppBundle\QPush;
use Doctrine\Common\Cache\Cache;
use Symfony\Bridge\Monolog\Logger;
use AppBundle\Entity\DoctrineMessage;
use Uecode\Bundle\QPushBundle\Event\MessageEvent;
use Uecode\Bundle\QPushBundle\Message\Message;
use Uecode\Bundle\QPushBundle\Provider\ProviderInterface;
class DoctrineProvider implements ProviderInterface {
protected $em;
/**
* Constructor for Provider classes
*
* @param string $name Name of the Queue the provider is for
* @param array $options An array of configuration options for the Queue
* @param mixed $client A Queue Client for the provider
* @param Cache $cache An instance of Doctrine\Common\Cache\Cache
* @param Logger $logger An instance of Symfony\Bridge\Mongolog\Logger
*/
public function __construct($name, array $options, $client, Cache $cache, Logger $logger)
{
$this->name = $name;
$this->options = $options;
$this->cache = $cache;
$this->logger = $logger;
$this->em = $this->getDoctrine()->getManager();
}
Other functions still in development