public function __invoke(FormEvent $event)
 {
     if ('job' != $event->getParam('param_name') || $event->getForm()->getObject()) {
         return;
     }
     $jobId = $event->getParam('param_value');
     $entity = $this->repository->findByJobId($jobId);
     if ($entity) {
         $invoiceAddress = $entity->getInvoiceAddress();
     } else {
         $callback = $this->createEntityCallback;
         $invoiceAddress = $callback();
         $entity = $this->repository->create(['jobId' => $jobId, 'invoiceAddress' => $invoiceAddress], true);
         /* If form is not instantiated until rendering, the PersistenceListener has already run
          * at this time. So we need to manually store the entity to be sure it is persisted.
          *
          */
         $this->repository->store($entity);
     }
     $form = $event->getForm();
     $form->bind($invoiceAddress);
 }
 public function __invoke(FormEvent $event)
 {
     $job = $event->getParam('job');
     if ($job->isDraft()) {
         return;
     }
     /* @var \Orders\Form\InvoiceAddress $invoiceAddress */
     $invoiceAddress = $event->getForm()->getForm('invoice.invoiceAddress');
     $invoiceAddress->setDisplayMode(SummaryFormInterface::DISPLAY_SUMMARY);
     foreach ($invoiceAddress->getBaseFieldset() as $element) {
         $element->setAttribute('disabled', true);
     }
 }