mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: connector on watchlist
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Config\TriggerAction;
|
||||
use App\Entity\User;
|
||||
use App\Entity\WatchList;
|
||||
use App\Entity\WatchListTrigger;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
@@ -55,13 +53,6 @@ class WatchListController extends AbstractController
|
||||
{
|
||||
$watchList = $this->serializer->deserialize($request->getContent(), WatchList::class, 'json', ['groups' => 'watchlist:create']);
|
||||
$watchList->setUser($this->getUser());
|
||||
/** @var WatchListTrigger $trigger */
|
||||
foreach ($watchList->getWatchListTriggers()->toArray() as $trigger) {
|
||||
if ($trigger->getAction() === TriggerAction::SendEmail && $trigger->getConnector() !== null)
|
||||
throw new Exception('No connector needed to send email');
|
||||
if ($trigger->getAction() === TriggerAction::BuyDomain && $trigger->getConnector() === null)
|
||||
throw new Exception('Unable to order a domain name without a Connector');
|
||||
}
|
||||
|
||||
$this->em->persist($watchList);
|
||||
$this->em->flush();
|
||||
|
||||
Reference in New Issue
Block a user