<commit_before><?php 
/**
 * @autor <NAME>
 */

namespace HealthCareAbroad\HelperBundle\Services\Filters;

use HealthCareAbroad\TreatmentBundle\Entity\Treatment;

class TreatmentListFilter extends ListFilter
{

    function __construct($doctrine)
    {
        parent::__construct($doctrine);

        // Add treatment in validCriteria
        $this->addValidCriteria('subSpecialization');
    }

    function setFilterOptions()
    {
        $this->setMedicalProcedureTypeFilterOption();

        $this->setStatusFilterOption();
    }

    function setMedicalProcedureTypeFilterOption()
    {        
        // Set The Filter Option 
        $subSpecializations = $this->doctrine->getEntityManager()->getRepository('TreatmentBundle:SubSpecialization')->findByStatus(Treatment::STATUS_ACTIVE);
        $options = array(ListFilter::FILTER_KEY_ALL => ListFilter::FILTER_LABEL_ALL);
        foreach($subSpecializations as $each) {
            $options[$each->getId()] = $each->getName();
        }

        $this->filterOptions['subSpecialization'] = array(
            'label' => 'Sub-specialization',
            'selected' => $this->queryParams['subSpecialization'],
            'options' => $options
        );
    }

    function buildQueryBuilder()
    {
        $this->queryBuilder->select('a')->from('TreatmentBundle:Treatment', 'a');

        if ($this->queryParams['status'] != ListFilter::FILTER_KEY_ALL) {
            $this->queryBuilder->where('a.status = :status');
            $this->queryBuilder->setParameter('status', $this->queryParams['status']);
        }
        
        if ($this->queryParams['subSpecialization'] != ListFilter::FILTER_KEY_ALL) {
            $this->queryBuilder->andWhere('a.subSpecialization = :subSpecialization');
            $this->queryBuilder->setParameter('subSpecialization', $this->criteria['subSpecialization']);
        }

        if($this->sortBy == 'subSpecialization') {
            $this->queryBuilder->leftJoin('a.subSpecialization', 'b');<commit_msg>updated search filter in treatments<commit_after><?php 
/**
 * @autor <NAME>
 */

namespace HealthCareAbroad\HelperBundle\Services\Filters;

use HealthCareAbroad\TreatmentBundle\Entity\Specialization;

use HealthCareAbroad\TreatmentBundle\Entity\Treatment;

class TreatmentListFilter extends ListFilter
{

    function __construct($doctrine)
    {
        parent::__construct($doctrine);

        // Add treatment in validCriteria
        $this->addValidCriteria('specialization');
    }

    function setFilterOptions()
    {
        $this->setMedicalProcedureTypeFilterOption();

        $this->setStatusFilterOption();
    }

    function setMedicalProcedureTypeFilterOption()
    {        
        // Set The Filter Option 
        $specializations = $this->doctrine->getEntityManager()->getRepository('TreatmentBundle:Specialization')->findByStatus(Specialization::STATUS_ACTIVE);
        $options = array(ListFilter::FILTER_KEY_ALL => ListFilter::FILTER_LABEL_ALL);
        foreach($specializations as $each) {
            $options[$each->getId()] = $each->getName();
        }

        $this->filterOptions['specialization'] = array(
            'label' => 'Specialization',
            'selected' => $this->queryParams['specialization'],
            'options' => $options
        );
    }

    function buildQueryBuilder()
    {
        $this->queryBuilder->select('a')->from('TreatmentBundle:Treatment', 'a');

        if ($this->queryParams['status'] != ListFilter::FILTER_KEY_ALL) {
            $this->queryBuilder->where('a.status = :status');
            $this->queryBuilder->setParameter('status', $this->queryParams['status']);
        }
        
        if ($this->queryParams['specialization'] != ListFilter::FILTER_KEY_ALL) {
            $this->queryBuilder->andWhere('a.specialization = :specialization');
            $this->queryBuilder->setParameter('specialization', $this->criteria['specialization']);
        }

        if($this->sortBy == 'specialization') {
            $this->queryBuilder->leftJoin('a.specialization', 'b');
{'fraction_non_alphanumeric': 0.1466600936652699, 'fraction_numerical': 0.0, 'mean_word_length': 3.2182952182952183, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 71, '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': '2655746', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1062, 'n_words': 143}