src/Invoice/EventSubscriber/SetCustomerSupplierRelationshipSubscriber.php line 43
<?phpdeclare(strict_types=1);/*** Copyright (c) 2020 TECLA Consulting Group oü.* All rights reserved.** This unpublished material is proprietary to TECLA Consulting Group oü.* All rights reserved. The methods and* techniques described herein are considered trade secrets* and/or confidential. Reproduction or distribution, in whole* or in part, is forbidden except by express written permission* of TECLA Consulting Group oü.** @author Matúš Sýkorjak <matus@tecla.no>* @copyright 2020 TECLA Consulting Group oü*/namespace App\Invoice\EventSubscriber;use App\Contact\Service\ContactRelationshipCustomerSupplierService;use App\Invoice\Event\InvoiceCreatedEvent;use JetBrains\PhpStorm\ArrayShape;use Symfony\Component\EventDispatcher\EventSubscriberInterface;final class SetCustomerSupplierRelationshipSubscriber implements EventSubscriberInterface{private ContactRelationshipCustomerSupplierService $relationshipService;public function __construct(ContactRelationshipCustomerSupplierService $relationshipService){$this->relationshipService = $relationshipService;}#[ArrayShape([InvoiceCreatedEvent::class => "string"])]public static function getSubscribedEvents(): array{return [InvoiceCreatedEvent::class => 'onInvoiceCreated',];}public function onInvoiceCreated(InvoiceCreatedEvent $event): void{$invoice = $event->getInvoice();$this->relationshipService->setRelationshipBetweenContacts($invoice->getSupplier(), $invoice->getCustomer());}}