Creates a form to edit a Country entity.

@param Country $entity The entity

@return \Symfony\Component\Form\Form The form
19642
private function createEditForm(Country $entity)
    {
        $form = $this->createForm(new CountryType($this->get('doctrine.orm.entity_manager')->getRepository('OrkestroLocaleBundle:Locale')), $entity, array(
            'action' => $this->generateUrl('orkestro_backend_country_update', array('iso_code' => $entity->getIsoCode())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
593247
public function createForm($entity, $formFactory, $action = null, $options = [])
    {
        if (!$entity instanceof ContactClient) {
            throw new MethodNotAllowedHttpException(['ContactClient']);
        }

        if (!empty($action)) {
            $options['action'] = $action;
        }

        // Prevent clone action from complaining about extra fields.
        $options['allow_extra_fields'] = true;

        return $formFactory->create('contactclient', $entity, $options);
    }
523451
protected function buildForm()
    {
        // Create countries and shipping modules list
        $countries = [0 => '   '];

        $list = CountryQuery::create()->find();

        /** @var \Thelia\Model\Country $item */
        foreach ($list as $item) {
            $countries[$item->getId()] = $item->getTitle();
        }

        asort($countries);

        $countries[0] = Translator::getInstance()->trans("All countries");

        $modules = [0 => '   '];

        $list = ModuleQuery::create()->filterByActivate(BaseModule::IS_ACTIVATED)->filterByType(BaseModule::DELIVERY_MODULE_TYPE)->find();

        /** @var Module $item */
        foreach ($list as $item) {
            $modules[$item->getId()] = $item->getTitle();
        }

        asort($modules);

        $modules[0] = Translator::getInstance()->trans("All shipping methods");

        $this->formBuilder
            ->add(
                'code',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkDuplicateCouponCode"],
                                ],
                                "groups" => "creation",
                            ]
                        ),
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkCouponCodeChangedAndDoesntExists"],
                                ],
                                "groups" => "update",
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'title',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                    ]
                ]
            )
            ->add(
                'shortDescription',
                'text'
            )
            ->add(
                'description',
                'textarea'
            )
            ->add(
                'type',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new NotEqualTo(
                            [
                                'value' => -1,
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'isEnabled',
                'text',
                []
            )
            ->add(
                'startDate',
                'text',
                [
                    'constraints' => [
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkLocalizedDate"],
                                ],
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'expirationDate',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new Callback(
                            [
                                "methods" => [
                                    [$this, "checkLocalizedDate"],
                                    [$this, "checkConsistencyDates"],
                                ],
                            ]
                        ),
                    ]
                ]
            )
            ->add(
                'isCumulative',
                'text',
                []
            )
            ->add(
                'isRemovingPostage',
                'text',
                []
            )
            ->add(
                'freeShippingForCountries',
                'choice',
                [
                    'multiple' => true,
                    'choices'  => $countries
                ]
            )
            ->add(
                'freeShippingForModules',
                'choice',
                [
                    'multiple' => true,
                    'choices'  => $modules
                ]
            )
            ->add(
                'isAvailableOnSpecialOffers',
                'text',
                []
            )
            ->add(
                'maxUsage',
                'text',
                [
                    'constraints' => [
                        new NotBlank(),
                        new GreaterThanOrEqual(['value' => -1]),
                    ]
                ]
            )
            ->add(
                'perCustomerUsageCount',
                'choice',
                [
                    'multiple' => false,
                    'required' => true,
                    'choices'  => [
                        1 => Translator::getInstance()->trans('Per customer'),
                        0 => Translator::getInstance()->trans('Overall'),
                    ]
                ]
            )
            ->add(
                'locale',
                'hidden',
                [
                    'constraints' => [
                        new NotBlank(),
                    ]
                ]
            )
            ->add(
                'coupon_specific',
                'collection',
                [
                    'allow_add'    => true,
                    'allow_delete' => true,
                ]
            )
        ;
    }
969546
private function createCreateForm(User $entity)
    {
        $form = $this->createForm(new UserType(), $entity, array(
            'action' => $this->generateUrl('admin_user_create'),
            'method' => 'POST',
            'is_creation' => true
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
747828
public function setCountry(\Haven\PersonaBundle\Entity\Country $country = null)
    {
        $this->country = $country;
    
        return $this;
    }
853406
private function createEditForm(MediaType $entity)
    {
        $form = $this->createForm(new MediaTypeType(), $entity, array(
            'action' => $this->generateUrl('mediatype_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
223036
public function setCountry(\Tx_Oelib_Model_Country $country = null)
    {
        $countryCode = ($country !== null) ? $country->getIsoAlpha3Code() : '';

        $this->setAsString('static_info_country', $countryCode);
    }
1133631
public function setCountry(\BlackForest\PiwikBundle\Entity\PiwikCountry $country = null)
    {
        $this->country = $country;

        return $this;
    }
170104
private function createMenuItemEditForm(MenuItem $entity)
    {
        $form = $this->createForm(new MenuItemType(), $entity, array(
            'action' => $this->generateUrl('admin_menu_item_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
515708
private function createCreateForm(SurveyCategory $entity)
    {
        $form = $this->createForm(new SurveyCategoryType(), $entity, array(
            'action' => $this->generateUrl('surveycategory_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
850790
private function createEditForm(ProductOrderItem $entity)
    {
        $form = $this->createForm(new ProductOrderItemType(), $entity, array(
            'action' => $this->generateUrl('admin_orderitem_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
937148
private function createEditForm(GalleryItem $entity)
    {
        $form = $this->createForm(new GalleryItemType(), $entity, array(
            'action' => $this->generateUrl('admin_galleryitem_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
443718
private function createEditForm(Role $entity)
    {
        $form = $this->createForm('sam_role', $entity, array(
            'action' => $this->generateUrl('sam_role_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        return $form;
    }
88629
public function edit(State $state)
    {
        $countryOptions = $this->_getCountryOptions();
        return view('avored-framework::system.state.edit')
            ->with('model', $state)
            ->with('countryOptions', $countryOptions);
        ;
    }
389889
public function editAction()
        {

            /** @var License $oLicense */
            $oLicense = LicenseQuery::create()->findOne();

            if ($oLicense === null) {
                throw $this->createNotFoundException('Unable to find License entity.');
            }

            $oLicense->setValidUntil(date("d.m.Y", $oLicense->getValidUntil()));
            $editForm = $this->createEditForm($oLicense);

            return $this->render('SlashworksAppBundle:License:edit_license.html.twig', array(
                'entity'    => $oLicense,
                'edit_form' => $editForm->createView(),
            ));
        }
725482
public static function make(string $country = null)
    {
        if (empty($country)) {
            $country = config('default');
        }

        return (new static() )->setCurrency($country);
    }
644710
public function newAction()
    {
        $entity = new Country();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }