/**
  * @param FormInterface $form
  * @param GitHubIssue   $data
  */
 protected function addAssignedToField($form, $data)
 {
     if ($data->getAssignedTo()) {
         $targetEntity = $data->getAssignedTo()->getPartner();
     } else {
         $targetEntity = $this->getTargetEntityFromRequest();
     }
     if ($targetEntity instanceof Partner) {
         $gitHubAccounts = $targetEntity->getGitHubAccounts();
     }
     // Add selection of GitHub accounts to assign the issue to,
     // if there are more than one available for the target entity
     if ($gitHubAccounts) {
         if (count($gitHubAccounts) > 1) {
             $form->add('assignedTo', 'entity', ['required' => true, 'label' => 'orocrm.partner.form.github_account.label', 'class' => 'OroCRMPartnerBundle:GitHubAccount', 'choices' => $gitHubAccounts]);
         } elseif (!$data->getAssignedTo() && count($gitHubAccounts) == 1) {
             $data->setAssignedTo($gitHubAccounts->first());
         }
     }
 }
 /**
  * @Route("/update/{id}", name="orocrm_partner_github_issue_update", requirements={"id"="\d+"})
  * @Template
  * @Acl(
  *      id="orocrm_partner_github_issue_update",
  *      type="entity",
  *      class="OroCRMPartnerBundle:GitHubIssue",
  *      permission="EDIT",
  *      group_name=""
  * )
  */
 public function updateAction(GitHubIssue $entity, Request $request)
 {
     $formAction = $this->get('router')->generate('orocrm_partner_github_issue_update', ['id' => $entity->getId()]);
     return $this->update($entity, $formAction, $request);
 }