/**
  * (non-PHPdoc)
  * @see \Symfony\Component\Form\DataTransformerInterface::reverseTransform()
  */
 public function reverseTransform($string)
 {
     $criterias = array('name' => $string);
     if (!is_null($this->type)) {
         $criterias['type'] = $this->type;
     }
     $identity = $this->identityManager->getRepository()->findOneBy($criterias);
     if (is_null($identity)) {
         $identity = $this->identityManager->createInstance();
         $identity->setName($string);
     }
     return $identity;
 }
 /**
  * Create new typed Instance of entity
  *
  * @param string $type Type of instance
  */
 public function createTypedInstance($type)
 {
     if ($type == ContactDeviceModel::TYPE_EMAIL) {
         $entityName = $this->emailAddressManager->getClassName();
     } elseif ($type == ContactDeviceModel::TYPE_PHONE) {
         $entityName = $this->phoneNumberManager->getClassName();
     } elseif ($type == ContactDeviceModel::TYPE_WEBSITE) {
         $entityName = $this->websiteAddressManager->getClassName();
     } else {
         throw new \Exception(sprintf('The type "%s" is not a valid ContactDevice inheritance entity', $type));
     }
     $entity = new $entityName();
     return $entity;
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('label' => 'Identity', 'class' => $this->identityManager->getClassName(), 'choice_label' => 'Name', 'placeholder' => 'Choose an identity', 'attr' => array('class' => 'select2-entity-ajax', 'data-route' => 'asf_contact_ajax_request_identity_by_name'), 'identity_type' => null));
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('label' => 'Province', 'translator_domain' => 'asf_contact', 'empty_value' => 'Please choice a province', 'class' => $this->provinceManager->getClassName(), 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('p')->orderBy('p.code', 'ASC');
     }));
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('data_class' => $this->contactDeviceManager->getClassName(), 'translation_domain' => 'asf_contact'));
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('data_class' => $this->personManager->getClassName(), 'translation_domain' => 'asf_contact', 'is_new' => false));
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('data_class' => $this->identityOrganizationManager->getClassName()));
 }
 /**
  * (non-PHPdoc)
  * @see \Symfony\Component\Form\DataTransformerInterface::reverseTransform()
  */
 public function reverseTransform($string)
 {
     $province = $this->provinceManager->getRepository()->findOneBy(array('name' => $string));
     return $province;
 }