Questions tagged [query-builder]

A query-builder is a set of classes and methods that is able to programmatically build queries.

It provides a set of classes and methods that is able to programmatically build queries, and also provides a fluent API.

This functionality can be embedded on an or be independent.

Functionality

  • Queries more readable
  • Can be cross database

Query Builders documentation

2553 questions
0
votes
0 answers

I am using elasticsearch in java and want to convert below to java code. I am having difficulty with aggregation and terms syntax

My Query is as follows POST user-info/_search { "size": 0, "query": { "bool": { "must": [ { "match_all": {} } ], "filter": { "range": { …
0
votes
2 answers

Is it possible to translate this "join" and "as" query to Laravel PDO functions?

I am struggling to make this SQL query to a Laravel PDO query. Does anyone know how I can do this? (Especially the 'AS' statements and the naming in the joins). Query: SELECT models.name as model_name, models.brand as…
Niels Bosman
  • 826
  • 1
  • 8
  • 19
0
votes
0 answers

How to return all values of a collection when using Laravel whenEmpty

I am new to Laravel and is trying to fix someone else' code. I am selecting users (joining users table and user_details table) into $users collection. Then applying some filters/conditions into that. For example, when comparing mother tongue…
Justin
  • 63
  • 6
0
votes
1 answer

Many to many query builder laravel

Here is my query code: $apartments = DB::table('apartments') ->when($request->filled('wifi'), function ($query) { $query->join('apartment_service' , function($join){ $join -> on('apartments.id' , '=' ,…
folipso
  • 107
  • 1
  • 8
0
votes
2 answers

Call to a member function getQuery() on null symfony

I'm following this tuto about CSV export on EasyAdmin bundle in symfony (link) and I'm stuck at this point: $queryBuilder = $this->createListQueryBuilder( Employee::class, $sortDirection, …
0
votes
1 answer

Relation onetoone in QueryBuilder

I'm trying to make a query with QueryBuilder for a delete already used object. The correct Mysql query is: SELECT * FROM token LEFT JOIN att_token ON token.id = att_token.id_token_id WHERE att_token.id_utilisateur_id IS null ORDER BY token.num_serie…
Totorux
  • 3
  • 1
0
votes
1 answer

Cakephp 3.x Table Beforefind, unable to stop event

Per the documentation on the website of CakePHP: (https://book.cakephp.org/3/en/orm/table-objects.html#beforefind) stopping the event or supplying a return value should stop the find operation. I'm using the following code in the…
Robin.v
  • 719
  • 3
  • 8
  • 16
0
votes
2 answers

Display result in graph based on combination of year and month selection in laravel

i am display graph of sum of qty datewise it works but now i want to display graph in which sum of qty of month and year combine selection. My date is stored in format 2020-02-14 and i want to display sum of qty of 2020-02 that is from 2019-02 to…
0
votes
2 answers

My laravel project but some data not sound in query

public function plan($id){ $video = DB::select("SELECT * FROM `video` WHERE `video_episod` = ".$id." "); dd($video); return view('users.subplan', ['plan' => $plan]); } dd($video); result : []
0
votes
0 answers

Reuse builder step across different builders

For a C# data access layer I want to use the builder design pattern to build queries against DBContexts (for greater flexiblity in the buisiness layer but without direct access to IQueryable) in a fluent API way. Many queries have a similar…
Eike S
  • 300
  • 1
  • 11
0
votes
1 answer

Getting error on NOT IN subquery in Doctrine (Symfony 4)

I'm trying to convert this MySql query SELECT appcs_training.name, appcs_training.id FROM appcs_training WHERE appcs_training.id NOT IN (SELECT training_id FROM appcs_user_purchased_trainings WHERE user_id = 54) into a queryBuilder but I am…
0
votes
1 answer

Symfony queryBuilder, can`t rewrite sql to queryBuidler

I can`t rewrite SQL query to queryBuilder, for my task need only queryBuilder object. I have this SQL query, I need take from database per each user, orders which be last and have isPaid = 0. SELECT * FROM orders o JOIN …
0
votes
1 answer

Laravel 5: Query Builder: Get the record using date in datetime datatype

I have column date and the data type is datetime, now I want to fetch all the related date with a certain date. I want to monitor how many items I've bought in a certain year but what I have right now is, I'm not getting any value. Example My date…
Angel
  • 966
  • 4
  • 25
  • 60
0
votes
0 answers

AEM Query needed for property/nodename within component

I tried to extract the pages which have the node fileReferance within component, I tried to use property.depth and also nodename for the same however, its not showing any results. Please find below screenshot from CRX: Can you please help me to…
Mayur Alaspure
  • 69
  • 1
  • 2
  • 11
0
votes
1 answer

How to implement a combined cross and inner joins in Laravel?

I have defined 3 tables in Laravel as follow: Schema::create('locales', function (Blueprint $table) { $table->string('id', 2); $table->string('name', 5000); $table->timestamps(); …
MJBZA
  • 4,796
  • 8
  • 48
  • 97
1 2 3
99
100