Querybuilder Making Dynamic Query Problem

Hi I'm gonna use querybuilder to create dynamic query based on requests and have it on my resultset

                $builder = $this->modelsManager->createBuilder()
                if ( $condition ){
                        $builder->where( $someCondition )->getQuery()->execute( $params );

my goal is creating query dynamiclly for example join other tables if needed or add another where conditions and perhaps params.. should I use PHQL instead?


thanks, but it isn't lookalike query builder. and I wanna know why is it like that..! is it a bug or i missused it. then.. should i use PHQL as you did?

how I use it



i dont know the diffrence to be honest, but raw queries are more readable. I always use models, when there is no cheeky stuff. When it comes to dynamic table name, or when it starts taking me hours to make it work with model, i just go for this method.

I dont think there is any difference, just use what's easy and elegant for you.