Commit c3b15b73 by Mathieu Poisbeau

Fix #469: le solde de monnaie nantie doit diminuer

parent 56c08ee3
......@@ -38,11 +38,18 @@ class TransfertPrestataireComptoir extends Transfert
$this->getDestinataire()->addCompte($this->getMontant());
$this->getDestinataire()->getGroupe()->getSiege()->removeCompteNantie($this->getMontant());
return [$this->getExpediteur(), $this->getDestinataire()];
return [
$this->getExpediteur(),
$this->getDestinataire(),
$this->getDestinataire()->getGroupe()->getSiege(), // fix #469: do not forget to persist the 'Siege' entity
];
}
public function getUsersToNotify()
{
return array_merge($this->getDestinataire()->getGestionnaires()->toArray(), $this->getExpediteur()->getUsers()->toArray());
return array_merge(
$this->getDestinataire()->getGestionnaires()->toArray(),
$this->getExpediteur()->getUsers()->toArray()
);
}
}
<?php
namespace App\Listener;
use App\Entity\Flux;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\ORM\Events;
use Symfony\Component\Security\Core\Security;
class FluxListener implements EventSubscriber
{
private $em;
private $security;
public function __construct(EntityManagerInterface $em, Security $security)
{
$this->em = $em;
$this->security = $security;
}
public function getSubscribedEvents()
{
return array(Events::onFlush);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment