<?php
namespace Aqarmap\Bundle\ListingBundle\EventListener;
use Aqarmap\Bundle\ListingBundle\Event\ListingEvent;
use Aqarmap\Bundle\ListingBundle\Service\ListingRateService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ListingRatedListener implements EventSubscriberInterface
{
/** @var ListingRateService */
private $listingRateService;
public function __construct(ListingRateService $listingRateService)
{
$this->listingRateService = $listingRateService;
}
public function onRating(ListingEvent $event): void
{
$this->listingRateService->resetRateStatus($event->getListing());
$this->listingRateService->markRatePendingReview($event->getListing());
}
/**
* {@inheri tdoc}.
*/
public static function getSubscribedEvents()
{
return [
'aqarmap.listing_got_rated' => 'onRating',
];
}
}