<commit_before><?php

/*
 * This file is part of the RmzamoraSandboxInitDataBundle package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Rmzamora\SandboxInitDataBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;

use Sonata\NewsBundle\Model\CommentInterface;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LoadClassificationData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
    private $container;

    function getOrder()
    {
        return 2;
    }

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

    public function load(ObjectManager $manager)
    {

        //Create Default Context
        $context = $this->getContextManager()->create();
        $context->setId('default');
        $context->setEnabled(true);
        $context->setName('Default');
        $this->getContextManager()->save($context);
        $this->addReference('default-classification-context', $context);

        // Default Category
        $category = $this->getCategoryManager()->create();
        $category->setEnabled(true);
        $category->setName('Default');
        $category->setContext( $this->getReference('default-classification-context'));
        $this->getCategoryManager()->save($category);
        $this->addReference('default-classification-category-default', $category);

        // Create News Context
        $context = $this->getContextManager()->create();
        $context->setId('news');
        $context->setEnabled(true);
        $context->setName('News');
        $this->getContextManager()->save($context);
        $this->addReference('news-classification-context', $context);

        // News Category
        $category = $this->getCategoryManager()->create();
        $category->setEnabled(true);
        $category->setName('News');
        $category->setContext( $this->getReference('news-classification-context'));
        $this->getCategoryManager()->save($category);
        $this->addReference('news-classification-category-news', $category);



        $tags = array(
            'blog' => null,
            'article' => null,
            'event' => null,
            'promo' => null,
        );

        foreach($tags as $tagName => $null) {
            $tag = $this->getTagManager()->create();
            $tag->setEnabled(true);
            $tag->setName($tagName);
            $tag->setContext($this->getReference('default-classification-context'));
            $tags[$tagName] = $tag;
            $this->getTagManager()->save($tag);
            $this->addReference(sprintf('default-classification-tag-%s', $tagName), $tag);
        }

        // Default Collection
        $collection = $this->getCollectionManager()->create();
        $collection->setEnabled(true);<commit_msg>added default categories<commit_after><?php

/*
 * This file is part of the RmzamoraSandboxInitDataBundle package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Rmzamora\SandboxInitDataBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;

use Sonata\NewsBundle\Model\CommentInterface;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class LoadClassificationData extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
    private $container;

    function getOrder()
    {
        return 2;
    }

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

    public function load(ObjectManager $manager)
    {

        //Create Default Context
        $context = $this->getContextManager()->create();
        $context->setId('default');
        $context->setEnabled(true);
        $context->setName('Default');
        $this->getContextManager()->save($context);
        $this->addReference('default-classification-context', $context);

        // Default Category
        $category = $this->getCategoryManager()->create();
        $category->setEnabled(true);
        $category->setName('Default');
        $category->setContext( $this->getReference('default-classification-context'));
        $this->getCategoryManager()->save($category);
        $this->addReference('default-classification-category-default', $category);

        // Create News Context
        $context = $this->getContextManager()->create();
        $context->setId('news');
        $context->setEnabled(true);
        $context->setName('News');
        $this->getContextManager()->save($context);
        $this->addReference('news-classification-context', $context);

        // News Category
        $category = $this->getCategoryManager()->create();
        $category->setEnabled(true);
        $category->setName('News');
        $category->setContext( $this->getReference('news-classification-context'));
        $this->getCategoryManager()->save($category);
        $this->addReference('news-classification-category-news', $category);


        $categories = array('blog', 'event');

        foreach($categories as $cat) {
            $category = $this->getCategoryManager()->create();
            $category->setEnabled(true);
            $category->setName(ucwords($cat));
            $category->setContext( $this->getReference('news-classification-context'));
            $category->setParent( $this->getReference('news-classification-category-news'));
            $this->getCategoryManager()->save($category);
            $this->addReference(sprintf('news-classification-category-news-%s', $cat), $category);
        }

        // News Child Category BLOG
        $categories = array('technology', 'travel', 'entertainment', 'finance', 'business');
        foreach($categories as $cat) {
            $category = $this->getCategoryManager()->create();
            $category->setEnabled(true);
            $category->setName(ucwords($cat));
            $category->setContext( $this->getReference('news-classification-context'));
            $category->setParent( $this->getReference('news-classification-category-news-blog'));
            $this->getCategoryManager()->save($category);
            $this->addReference(sprintf('news-classification-category-news-blog-%s', $cat), $category);
        }

        // News Child Category EVENT
        $categories = array('trade fair', 'travel show', 'press conference', 'product launches', 'business conference', 'award', 'weddings', 'birthday', 'anniversary');
        foreach($categories as $cat) {
            $category = $this->getCategoryManager()->create();
            $category->setEnabled(true);
            $category->setName(ucwords($cat));
            $category->setContext( $this->getReference('news-classification-context'));
            $category->setParent( $this->getReference('news-classification-category-news-event'));
            $this->getCategoryManager()->save($category);
            $this->addReference(sprintf('news-classification-category-news-event-%s', $cat), $category);
        }

        $tags = array(
            'blog' => null,
            'article' => null,
            'event' => null,
            'promo' => null,
        );

        foreach($tags as $tagName => $null) {
            $tag = $this->getTagManager()->create();
            $tag->setEnabled(true);
            $tag->setName($tagName);
            $tag->setContext($this->getReference('default-classification-context'));
            $tags[$tagName] = $tag;
            $this->getTagManager()->save($tag);
            $this->addReference(sprintf('default-classification-tag-%s', $tagName), $tag);
        }

        // Default Collection
        $collection = $this->getCollectionManager()->create();
        $collection->setEnabled(true);
{'fraction_non_alphanumeric': 0.15131812270954015, 'fraction_numerical': 0.00023643456673365647, 'mean_word_length': 3.1248171623598244, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 146, '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': '3753924', 'n_tokens_mistral': 2209, 'n_tokens_neox': 2159, 'n_words': 368}