|
@@ -53,11 +53,7 @@ class ProducerService
|
|
|
$actionRepository = $this->getEntityManager()->getRepository('WorkflowBundle:Action');
|
|
|
$actions = $actionRepository->findAllByEventAndObjectClass($eventName, $entityClass);
|
|
|
foreach ($actions as $action) {
|
|
|
- $routing_key = "";
|
|
|
- if(getenv("AMQP_KEY") !== false){
|
|
|
- $routing_key = getenv("AMQP_KEY");
|
|
|
- }
|
|
|
- $this->publishMessage($action, $entity, $routing_key);
|
|
|
+ $this->publishMessage($action, $entity);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -78,10 +74,7 @@ class ProducerService
|
|
|
$entityRepository = $entityManager->getRepository($entityClass);
|
|
|
$entity = $entityRepository->find($entityId);
|
|
|
if (in_array($entityClass, WorkFlowEntityClasses::getConstants())) {
|
|
|
- $routing_key = "";
|
|
|
- if(getenv("AMQP_KEY") !== false){
|
|
|
- $routing_key = getenv("AMQP_KEY");
|
|
|
- }
|
|
|
+
|
|
|
$this->publishMessage($action, $entity);
|
|
|
}
|
|
|
}
|
|
@@ -90,8 +83,14 @@ class ProducerService
|
|
|
* @param Action $action
|
|
|
* @param Entity $entity
|
|
|
*/
|
|
|
- public function publishMessage(Action $action, $entity, $routing_key = "")
|
|
|
+ public function publishMessage(Action $action, $entity, $routing_key = false)
|
|
|
{
|
|
|
+ if($routing_key === false){
|
|
|
+ $routing_key = "";
|
|
|
+ if(getenv("AMQP_KEY") !== false){
|
|
|
+ $routing_key = getenv("AMQP_KEY");
|
|
|
+ }
|
|
|
+ }
|
|
|
$entityClass = get_class($entity);
|
|
|
$actionName = $action->getName();
|
|
|
$entityId = $entity->getId();
|