This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
497 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
QueueDoctrine | ||
============= | ||
|
||
Example usage [zf-queue](https://github.com/bupy7/zf-queue) package for Doctrine 2 ORM. | ||
|
||
Requirements | ||
------------ | ||
|
||
- [Doctrine 2 ORM](https://github.com/doctrine/DoctrineORMModule) | ||
- [Zend MVC](https://github.com/zendframework/zend-mvc) | ||
|
||
Install | ||
------- | ||
|
||
1. Copy `QueueDoctrine` to your `module` directory. | ||
|
||
2. Add `QueueDoctrine` to your config of module list. | ||
|
||
4. Profit. | ||
|
||
Usage | ||
----- | ||
|
||
1: [Create a task](https://github.com/bupy7/zf-queue/README.md#create-task) | ||
|
||
2: Add the task to queue: | ||
|
||
```php | ||
$container->get('Bupy7\Queue\Service\TaskService')->add('Some\Task\TaskNameClass', [ | ||
'some' => 'param', | ||
]); | ||
``` | ||
|
||
3: Run queue: | ||
|
||
```php | ||
$container->get('Bupy7\Queue\Service\QueueService')->run(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace QueueDoctrine; | ||
|
||
return [ | ||
'cli' => [ | ||
'commands' => [ | ||
Command\RunCommand::class, | ||
], | ||
], | ||
'command_manager' => [ | ||
'factories' => [ | ||
Command\RunCommand::class => \Zend\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory::class, | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace QueueDoctrine; | ||
|
||
return [ | ||
'doctrine' => [ | ||
'driver' => [ | ||
'queue_entity' => [ | ||
'class' => \Doctrine\ORM\Mapping\Driver\XmlDriver::class, | ||
'paths' => __DIR__ . '/mapping', | ||
], | ||
'orm_default' => [ | ||
'drivers' => [ | ||
'QueueDoctrine\Entity' => 'queue_entity', | ||
], | ||
], | ||
], | ||
], | ||
]; |
30 changes: 30 additions & 0 deletions
30
example/QueueDoctrine/config/mapping/ExQueue.Entity.Task.dcm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<entity name="QueueDoctrine\Entity\Task" table="queue_task" | ||
repository-class="QueueDoctrine\Repository\TaskRepository"> | ||
|
||
<indexes> | ||
<index name="queue_task_idx_1" columns="status_id"/> | ||
</indexes> | ||
|
||
<lifecycle-callbacks> | ||
<lifecycle-callback type="preFlush" method="preFlush"/> | ||
</lifecycle-callbacks> | ||
|
||
<id name="id" type="integer" column="id"> | ||
<generator strategy="IDENTITY"/> | ||
</id> | ||
|
||
<field name="name" type="string" column="name"/> | ||
<field name="statusId" type="smallint" column="status_id"/> | ||
<field name="createdAt" type="datetime" column="created_at"/> | ||
<field name="runAt" type="datetime" column="run_at" nullable="true"/> | ||
<field name="stopAt" type="datetime" column="stop_at" nullable="true"/> | ||
<field name="numberErrors" type="smallint" column="number_errors"/> | ||
<field name="params" type="params" column="params"/> | ||
</entity> | ||
</doctrine-mapping> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace QueueDoctrine; | ||
|
||
return [ | ||
'service_manager' => [ | ||
'factories' => [ | ||
Repository\TaskRepository::class => \ExDoctrine\Repository\RepositoryInvokableFactory::class, | ||
Manager\EntityManager::class => \Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory::class, | ||
\Bupy7\Queue\Service\QueueService::class => \QueueDoctrine\Service\QueueServiceFactory::class, | ||
\Bupy7\Queue\Service\TaskService::class => \QueueDoctrine\Service\TaskServiceFactory::class, | ||
], | ||
], | ||
\Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory::class => [ | ||
Manager\EntityManager::class => [ | ||
\Doctrine\ORM\EntityManager::class, | ||
], | ||
], | ||
]; |
Oops, something went wrong.