<commit_before><?php

namespace Ojs\LocationBundle\Helper;

use Doctrine\ORM\EntityManager;
use Ojs\LocationBundle\Entity\Country;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;

class FormHelper
{
    /** @var ContainerInterface */
    private $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    /**
     * @return ContainerInterface
     */
    public function getContainer()
    {
        return $this->container;
    }

    /**
     * @param ContainerInterface $container
     */
    public function setContainer($container)
    {
        $this->container = $container;
    }

    public function addCityField(FormBuilderInterface &$builder, $dataClass, $isMongo = false)
    {
        /** @var EntityManager $em */
        $em = $this->container->get('doctrine')->getManager();

        $factory = $builder->getFormFactory();

        $refreshTown = function (FormInterface $form, $country) use ($factory, $em, $isMongo) {
            $childs = [];
            if (!empty($country)) {
                /** @var Country $country */
                $country = $em->find('OjsLocationBundle:Country', $country);
                foreach ($country->getProvinces() as $child) {
                    if ($child->getType() == 1) {
                        $childs[$child->getId()] = $isMongo === false ? $child : $child->getName();
                    }
                }
            }
            $options = [<commit_msg>Remove the call to nonexistent Province::getType() method<commit_after><?php

namespace Ojs\LocationBundle\Helper;

use Doctrine\ORM\EntityManager;
use Ojs\LocationBundle\Entity\Country;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;

class FormHelper
{
    /** @var ContainerInterface */
    private $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    /**
     * @return ContainerInterface
     */
    public function getContainer()
    {
        return $this->container;
    }

    /**
     * @param ContainerInterface $container
     */
    public function setContainer($container)
    {
        $this->container = $container;
    }

    public function addCityField(FormBuilderInterface &$builder, $dataClass, $isMongo = false)
    {
        /** @var EntityManager $em */
        $em = $this->container->get('doctrine')->getManager();

        $factory = $builder->getFormFactory();

        $refreshTown = function (FormInterface $form, $country) use ($factory, $em, $isMongo) {
            $childs = [];
            if (!empty($country)) {
                /** @var Country $country */
                $country = $em->find('OjsLocationBundle:Country', $country);
                foreach ($country->getProvinces() as $child) {
                    $childs[$child->getId()] = $isMongo === false ? $child : $child->getName();
                }
            }
            $options = [
{'fraction_non_alphanumeric': 0.13267148014440433, 'fraction_numerical': 0.00030084235860409147, 'mean_word_length': 2.507383966244726, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '243426', 'n_tokens_mistral': 906, 'n_tokens_neox': 882, 'n_words': 181}