<?php

/**
 * Created by PhpStorm.
 * User: filip
 * Date: 10/21/16
 * Time: 4:23 PM.
 */

namespace KupShop\ElninoBundle\Query;

class QueryBuilder extends \Query\QueryBuilder
{
    public function joinSeriesOnProducts($seriesAlias = 'series')
    {
        $this->join('p', 'abra_series', $seriesAlias, "p.id_serie = {$seriesAlias}.id_serie");

        return $this;
    }

    public function joinModelsOnProducts($modelsAlias = 'abm')
    {
        $this->leftJoin('p', 'abra_models', $modelsAlias, "p.id_model = {$modelsAlias}.id_abra");

        return $this;
    }

    public function joinSectionsOnModels($sectionsAlias = 's')
    {
        $this->join('abm', 'abra_sections', 'abs', 'abm.id_section=abs.id_abra')
            ->join('abs', 'sections', $sectionsAlias, "abs.id_section={$sectionsAlias}.id");

        return $this;
    }
}
