<commit_before><?php

namespace AppBundle\DataFixtures\ORM;


use AppBundle\Entity\Adventure;
use AppBundle\Entity\TagContent;
use AppBundle\Entity\TagName;
use AppBundle\Service\FieldUtils;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Doctrine\ManagerRegistry;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Faker;
use function Symfony\Component\VarDumper\Tests\Caster\reflectionParameterFixture;

class RandomAdventuresData implements FixtureInterface, ContainerAwareInterface
{
    use ContainerAwareTrait;

    /**
     * Load data fixtures with the passed EntityManager
     *
     * @param ObjectManager $manager
     */
    public function load(ObjectManager $manager)
    {
        /** @var ManagerRegistry $doctrine */
        $doctrine = $this->container->get('doctrine');

        /** @var TagName[] $tags */
        $tags = $doctrine->getRepository('AppBundle:TagName')->findAll();

        $faker = Faker\Factory::create();

        // Disable indexing temporarily.
        $doctrine->getManager()->getEventManager()->removeEventSubscriber(
            $this->container->get('search_index_updater')
        );

        $fieldUtils = new FieldUtils();

        for ($i = 0; $i < 200; $i++) {
            $adventure = new Adventure();
            $adventure->setTitle($faker->text(120));

            foreach ($tags as $tag) {
                for ($j = 0; $j < 2; $j++) {
                    $info = new TagContent();
                    $info
                        ->setAdventure($adventure)
                        ->setTag($tag)
                        ->setApproved(true);
                    if (!$this->customFaker($tag, $info, $faker)) {
                        $info->setContent($fieldUtils->getFakerContent($faker, $tag->getType()));
                    }
                    $manager->persist($info);

                    if (!in_array($tag->getTitle(), ['NPCs', 'Author', 'Monsters', 'Notable Items'])) {
                        break;
                    }
                }
            }<commit_msg>Change the Adventures fixture to use catchPhrase instead of text<commit_after><?php

namespace AppBundle\DataFixtures\ORM;


use AppBundle\Entity\Adventure;
use AppBundle\Entity\TagContent;
use AppBundle\Entity\TagName;
use AppBundle\Service\FieldUtils;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Doctrine\ManagerRegistry;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Faker;
use function Symfony\Component\VarDumper\Tests\Caster\reflectionParameterFixture;

class RandomAdventuresData implements FixtureInterface, ContainerAwareInterface
{
    use ContainerAwareTrait;

    /**
     * Load data fixtures with the passed EntityManager
     *
     * @param ObjectManager $manager
     */
    public function load(ObjectManager $manager)
    {
        /** @var ManagerRegistry $doctrine */
        $doctrine = $this->container->get('doctrine');

        /** @var TagName[] $tags */
        $tags = $doctrine->getRepository('AppBundle:TagName')->findAll();

        $faker = Faker\Factory::create();

        // Disable indexing temporarily.
        $doctrine->getManager()->getEventManager()->removeEventSubscriber(
            $this->container->get('search_index_updater')
        );

        $fieldUtils = new FieldUtils();

        for ($i = 0; $i < 200; $i++) {
            $adventure = new Adventure();
            $adventure->setTitle($faker->catchPhrase);

            foreach ($tags as $tag) {
                for ($j = 0; $j < 2; $j++) {
                    $info = new TagContent();
                    $info
                        ->setAdventure($adventure)
                        ->setTag($tag)
                        ->setApproved(true);
                    if (!$this->customFaker($tag, $info, $faker)) {
                        $info->setContent($fieldUtils->getFakerContent($faker, $tag->getType()));
                    }
                    $manager->persist($info);

                    if (!in_array($tag->getTitle(), ['NPCs', 'Author', 'Monsters', 'Notable Items'])) {
                        break;
                    }
                }
            }
{'fraction_non_alphanumeric': 0.12569398178991784, 'fraction_numerical': 0.0033311125916055963, 'mean_word_length': 2.2685050798258346, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 43, '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': '369668', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1190, 'n_words': 231}