<commit_before><?php
/*
 * This file is part of the AlphaLemon CMS Application and it is distributed
 * under the GPL LICENSE Version 2.0. To use this application you must leave
 * intact this copyright notice.
 *
 * Copyright (c) AlphaLemon <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * For extra documentation and help please visit http://www.alphalemon.com
 *
 * @license    GPL LICENSE Version 2.0
 *
 */

namespace AlphaLemon\AlphaLemonCmsBundle\Core\Model\Propel;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use AlphaLemon\AlphaLemonCmsBundle\Core\Event\Query\Seo;
use AlphaLemon\AlphaLemonCmsBundle\Core\Event\Query\SeoEvents;
use AlphaLemon\AlphaLemonCmsBundle\Model\AlSeo;
use AlphaLemon\AlphaLemonCmsBundle\Model\AlSeoQuery;
use AlphaLemon\AlphaLemonCmsBundle\Core\Model\Entities\SeoModelInterface;
use AlphaLemon\AlphaLemonCmsBundle\Core\Exception\Content\General\InvalidParameterTypeException;

/**
 *  Adds some filters to the AlSeoQuery object
 *
 *  @author alphalemon <<EMAIL>>
 */
class AlSeoModelPropel extends Base\AlPropelModel implements SeoModelInterface
{
    /**
     * {@inheritdoc}
     */
    public function getModelObjectClassName()
    {
        return '\AlphaLemon\AlphaLemonCmsBundle\Model\AlSeo';
    }

    /**
     * {@inheritdoc}
     */
    public function fromPK($id)
    {
        $query = AlSeoQuery::create();

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPKQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PK, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->findPk($id);
    }

    /**
     * {@inheritdoc}
     */
    public function setModelObject($object = null)
    {
        if (null !== $object && !$object instanceof AlSeo) {
            throw new InvalidParameterTypeException('AlSeoModel accepts only AlSeo propel objects.');
        }

        return parent::setModelObject($object);
    }

    /**
     * {@inheritdoc}
     */
    public function fromPageAndLanguage($languageId, $pageId)
    {
        $query = AlSeoQuery::create()->filterByPageId($pageId)
                      ->filterByLanguageId($languageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPageAndLanguageQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_AND_LANGUAGE, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->findOne();
    }

    /**
     * {@inheritdoc}
     */
    public function fromPermalink($permalink, $languageId)
    {
        $query = AlSeoQuery::create()->filterByPermalink($permalink)
                      ->filterByLanguageId($languageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPermalinkQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PERMALINK, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->findOne();
    }

    /**
     * {@inheritdoc}
     */
    public function fromPageId($pageId)
    {
        $query = AlSeoQuery::create()->filterByPageId($pageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPageIdQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_ID, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $this->find();
    }

    /**
     * {@inheritdoc}
     */
    public function fromLanguageId($languageId)
    {
        $query = AlSeoQuery::create()->filterByLanguageId($languageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromLanguageIdQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_LANGUAGE_ID, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->find();
    }

    /**
     * {@inheritdoc}
     */
    public function fromPageIdWithLanguages($pageId)
    {
        $query = AlSeoQuery::create()
                            ->joinAlLanguage()
                            ->filterByPageId($pageId)
                            ->filterByToDelete(0)
                            ->orderByLanguageId();
        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPageIdWithLanguagesQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_ID_WITH_LANGUAGES, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->find();
    }
}<commit_msg>modified due to the new method added<commit_after><?php
/*
 * This file is part of the AlphaLemon CMS Application and it is distributed
 * under the GPL LICENSE Version 2.0. To use this application you must leave
 * intact this copyright notice.
 *
 * Copyright (c) AlphaLemon <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * For extra documentation and help please visit http://www.alphalemon.com
 *
 * @license    GPL LICENSE Version 2.0
 *
 */

namespace AlphaLemon\AlphaLemonCmsBundle\Core\Model\Propel;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use AlphaLemon\AlphaLemonCmsBundle\Core\Event\Query\Seo;
use AlphaLemon\AlphaLemonCmsBundle\Core\Event\Query\SeoEvents;
use AlphaLemon\AlphaLemonCmsBundle\Model\AlSeo;
use AlphaLemon\AlphaLemonCmsBundle\Model\AlSeoQuery;
use AlphaLemon\AlphaLemonCmsBundle\Core\Model\Entities\SeoModelInterface;
use AlphaLemon\AlphaLemonCmsBundle\Core\Exception\Content\General\InvalidParameterTypeException;

/**
 *  Adds some filters to the AlSeoQuery object
 *
 *  @author alphalemon <<EMAIL>>
 */
class AlSeoModelPropel extends Base\AlPropelModel implements SeoModelInterface
{
    /**
     * {@inheritdoc}
     */
    public function getModelObjectClassName()
    {
        return '\AlphaLemon\AlphaLemonCmsBundle\Model\AlSeo';
    }

    /**
     * {@inheritdoc}
     */
    public function fromPK($id)
    {
        $query = AlSeoQuery::create();

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPKQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PK, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->findPk($id);
    }

    /**
     * {@inheritdoc}
     */
    public function setModelObject($object = null)
    {
        if (null !== $object && !$object instanceof AlSeo) {
            throw new InvalidParameterTypeException('AlSeoModel accepts only AlSeo propel objects.');
        }

        return parent::setModelObject($object);
    }

    /**
     * {@inheritdoc}
     */
    public function fromPageAndLanguage($languageId, $pageId)
    {
        $query = AlSeoQuery::create()->filterByPageId($pageId)
                      ->filterByLanguageId($languageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPageAndLanguageQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_AND_LANGUAGE, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->findOne();
    }

    /**
     * {@inheritdoc}
     */
    public function fromPermalink($permalink, $languageId)
    {
        $query = AlSeoQuery::create()->filterByPermalink($permalink)
                      ->filterByLanguageId($languageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPermalinkQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PERMALINK, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->findOne();
    }

    /**
     * {@inheritdoc}
     */
    public function fromPageId($pageId)
    {
        $query = AlSeoQuery::create()->filterByPageId($pageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPageIdQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_ID, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $this->find();
    }

    /**
     * {@inheritdoc}
     */
    public function fromLanguageId($languageId)
    {
        $query = AlSeoQuery::create()->filterByLanguageId($languageId)
                      ->filterByToDelete(0);

        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromLanguageIdQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_LANGUAGE_ID, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->find();
    }

    /**
     * {@inheritdoc}
     */
    public function fromPageIdWithLanguages($pageId)
    {
        $query = AlSeoQuery::create()
                            ->joinAlLanguage()
                            ->filterByPageId($pageId)
                            ->filterByToDelete(0)
                            ->orderByLanguageId();
        if(null !== $this->dispatcher)
        {
            $event = new Seo\FromPageIdWithLanguagesQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_ID_WITH_LANGUAGES, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }
        }

        return $query->find();
    }
    
    /**
     * {@inheritdoc}
     */
    public function fetchSeoAttributesWithPagesAndLanguages()
    {
        $query = AlSeoQuery::create('a')
                    ->joinWith('a.AlPage')
                    ->joinWith('a.AlLanguage')
                    ->filterByToDelete(0)
                    ->orderByPageId()
                    ->orderByLanguageId();
        if(null !== $this->dispatcher)
        {
            /* TODo
            $event = new Seo\FromPageIdWithLanguagesQueringEvent($query);
            $this->dispatcher->dispatch(SeoEvents::FROM_PAGE_ID_WITH_LANGUAGES, $event);

            if($query !== $event->getQuery())
            {
                $query = $event->getQuery();
            }*/
        }

        return $query->find();
    }
}
{'fraction_non_alphanumeric': 0.1309071636781203, 'fraction_numerical': 0.0016782969702323117, 'mean_word_length': 1.9747766684182868, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 122, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7573643', 'n_tokens_mistral': 3297, 'n_tokens_neox': 3199, 'n_words': 535}