src/Form/EventSubscriber/Quote/CustomerSubscriber.php line 33
<?phpnamespace App\Form\EventSubscriber\Quote;use App\Entity\Addressing\Country;use App\Form\Type\Customer\CustomerForQuoteType;use App\Repository\Addressing\CountryRepository;use Sylius\Bundle\CustomerBundle\Form\Type\CustomerType;use Symfony\Bridge\Doctrine\Form\Type\EntityType;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\Form\Extension\Core\Type\TelType;use Symfony\Component\Form\FormEvent;use Symfony\Component\Form\FormEvents;use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;class CustomerSubscriber implements EventSubscriberInterface{private $tokenStorage;public function __construct(TokenStorageInterface $tokenStorageInterface){$this->tokenStorage = $tokenStorageInterface;}public static function getSubscribedEvents(){// Tells the dispatcher that you want to listen on the form.pre_set_data// event and that the preSetData method should be called.return [FormEvents::PRE_SET_DATA => 'preSetData'];}public function preSetData(FormEvent $event){$data = $event->getData();$form = $event->getForm();if (!$this->tokenStorage->getToken()) {$form->add('customer',CustomerForQuoteType::class);}}}