<commit_before><?php

namespace Victoire\Bundle\WidgetBundle\Repository;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Victoire\Bundle\CoreBundle\Entity\View;
use Victoire\Bundle\WidgetBundle\Entity\Widget;

/**
 * The Widget Repository.
 */
class WidgetRepository extends EntityRepository
{
    /**
     * Get all Widgets for a given View.
     *
     * @param View $view
     *
     * @return QueryBuilder
     */
    public function getAllForView(View $view)
    {
        //Get all WidgetMaps ids for this View
        $widgetMapsToSearch = [];
        foreach ($view->getBuiltWidgetMap() as $widgetMaps) {
            foreach ($widgetMaps as $widgetMap) {
                $widgetMapsToSearch[] = $widgetMap;
            }
        }

        return $this->createQueryBuilder('widget')
            ->join('widget.widgetMap', 'widgetMap')
            ->where('widgetMap IN (:widgetMaps)')
            ->setParameter('widgetMaps', $widgetMapsToSearch);
    }

    /**
     * Find all Widgets for a given View.
     *
     * @param View $view
     *
     * @return Widget[]
     */
    public function findAllWidgetsForView(View $view)
    {
        $qb = $this->getAllForView($view);

        return $qb->getQuery()->getResult();
    }
}<commit_msg>Change where with andWhere in WidgetRepository getAllForView method<commit_after><?php

namespace Victoire\Bundle\WidgetBundle\Repository;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Victoire\Bundle\CoreBundle\Entity\View;
use Victoire\Bundle\WidgetBundle\Entity\Widget;

/**
 * The Widget Repository.
 */
class WidgetRepository extends EntityRepository
{
    /**
     * Get all Widgets for a given View.
     *
     * @param View $view
     *
     * @return QueryBuilder
     */
    public function getAllForView(View $view)
    {
        //Get all WidgetMaps ids for this View
        $widgetMapsToSearch = [];
        foreach ($view->getBuiltWidgetMap() as $widgetMaps) {
            foreach ($widgetMaps as $widgetMap) {
                $widgetMapsToSearch[] = $widgetMap;
            }
        }

        return $this->createQueryBuilder('widget')
            ->join('widget.widgetMap', 'widgetMap')
            ->andWhere('widgetMap IN (:widgetMaps)')
            ->setParameter('widgetMaps', $widgetMapsToSearch);
    }

    /**
     * Find all Widgets for a given View.
     *
     * @param View $view
     *
     * @return Widget[]
     */
    public function findAllWidgetsForView(View $view)
    {
        $qb = $this->getAllForView($view);

        return $qb->getQuery()->getResult();
    }
}
{'fraction_non_alphanumeric': 0.12052730696798493, 'fraction_numerical': 0.0, 'mean_word_length': 2.4404145077720205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '2974675', 'n_tokens_mistral': 784, 'n_tokens_neox': 787, 'n_words': 173}