<?php
namespace App\EventSubscriber\Import;
use App\Service\Import\CustomRowEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class Brugis implements EventSubscriberInterface
{
/**
* @return array<string, mixed> The event names to listen to
*/
public static function getSubscribedEvents()
{
return [
CustomRowEvent::NAME => ['customRow'],
];
}
/**
* @return void
*/
public function customRow(CustomRowEvent $event)
{
if ($event->getEntity() != \App\Entity\Brugis::class) {
return;
}
$row = $event->getData();
foreach ($row as $k => $v) {
if ($v == 'N') {
$row[$k] = 0;
}
if ($v == 'O') {
$row[$k] = 1;
}
}
$event->setData($row);
}
}