Browse Source

Erreur 500 : SubscriptionBuilder::deleteSubscription()

feature/souke
Guillaume Bourgeois 9 months ago
parent
commit
e71197f79b
2 changed files with 21 additions and 10 deletions
  1. +9
    -4
      backend/controllers/SubscriptionController.php
  2. +12
    -6
      producer/controllers/SubscriptionController.php

+ 9
- 4
backend/controllers/SubscriptionController.php View File

$subscriptionModule = $this->getSubscriptionModule(); $subscriptionModule = $this->getSubscriptionModule();
$orderModule = $this->getOrderModule(); $orderModule = $this->getOrderModule();


$subscription = $subscriptionModule->findOneSubscriptionById($id);
$subscriptionModule->getOrderManager()->deleteOrdersIncomingDistributionsFromSubscription($subscription);
$subscriptionModule->deleteSubscription($subscription);
$subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id);


$this->setFlash('success', 'Abonnement supprimé');
if($subscription) {
$subscriptionModule->getOrderManager()->deleteOrdersIncomingDistributionsFromSubscription($subscription);
$subscriptionModule->deleteSubscription($subscription);
$this->setFlash('success', 'Abonnement supprimé');
}
else {
$this->setFlash('danger', 'Abonnement introuvable');
}


return $this->redirect(['subscription/index']); return $this->redirect(['subscription/index']);
} }

+ 12
- 6
producer/controllers/SubscriptionController.php View File

} }


$subscriptionModule = $this->getSubscriptionModule(); $subscriptionModule = $this->getSubscriptionModule();
$subscription = $subscriptionModule->findOneSubscriptionById($id);
$subscriptionModule->deleteSubscription($subscription);
$subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id);

if($subscription) {
$subscriptionModule->getBuilder()->deleteSubscription($subscription);
// @TODO : gérer via événements
$this->getSubscriptionModule()->getOrderManager()
->deleteOrdersIncomingDistributionsFromSubscription($subscription);


// @TODO : gérer via événements
$this->getSubscriptionModule()->getOrderManager()
->deleteOrdersIncomingDistributionsFromSubscription($subscription);
$this->setFlash('success', 'Abonnement supprimé');
}
else {
$this->setFlash('error', 'Abonnement introuvable');
}


$this->setFlash('success', 'Abonnement supprimé');


return $this->redirect(['subscription/index']); return $this->redirect(['subscription/index']);
} }

Loading…
Cancel
Save