Questions tagged [query]

The tag has no usage guidance.

18 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
50 views

Database Query in debugger consistently showing over 2000ms

In trying to optimize my Craft 3 site, I have discovered that it's apparently taking longer than expected to query my database. The duration for the apparent culprit is typically between 1900 and ...
1
vote
0answers
121 views

Advanced queries with Super Table

I have three channels: Events, stages and artists. An artist is added to a timetable super table field in the stage channel. In the event, I have a stages field where I select stages. Events also ...
1
vote
0answers
55 views

What's the most performant way to get reverse related entries within an Element Query?

What's the most performant way to get reverse related entries within an Element Query? Here's a contrived example of this. I have thousands of "book" entries and thousands of "collection" entries. I ...
1
vote
0answers
78 views

How to get url from related entry in another site

I'm relating entries from another site in my installation, and I'm having issues getting the correct URL for the entry. This is an example of what I currently have: {% set carouselEntries = entry....
1
vote
0answers
46 views

Order entries by a matrix field category

I have a lot of trouble in understanding the database/model structure and how to work with the query builder. I tried playing a bit with leftJoins but i cannot seem to make complex queries in craft 3. ...
1
vote
0answers
23 views

Paginate entries based on related status

So, let's assume I have two channels. events and movies, being events the screening time of each movie. In the admin, in the event entry, you can select one movie. The movie could be disabled. The ...
1
vote
0answers
53 views

Check the field type of all the attributes of an entry

Here's the whole picture: I'm trying to make an API endpoint which should output everything from an entry: First I did this: public function transform(Entry $entry) { return $entry-...
1
vote
0answers
348 views

Category counts for query results

I'm trying to display results from a search. I want to display the categories represented by the search results and the entry count for that category. Think of how Amazon's "refine results" sidebar ...
1
vote
0answers
56 views

Combine multi-tiered loop into a single query (via plugin)

I am very new to Craft so forgive me if I knacker how this is asked. I have a set of IDs in an array. I try sending that into a relatedTo statement (which yields a series of locations...see below ...
1
vote
0answers
18 views

Can I use relational parameters that query as items on their own?

I am running a craft site on craft 2.6.2997 and latest craft commerce. I am building a url query that allows the user to add query params to the url with a bit of js. The url structure is as follows ...
1
vote
0answers
87 views

How to insert data with the querybuilder?

Is it possible to insert data with the query builder if so how? I want to make (backend) fields by queries. What is the easiest way to do this? Or do I have to use regular mysql queries?
0
votes
1answer
15 views

Mass enable entries

I'm trying to set statuses to enabled in mysql. Around 150k entries. The tables are elements and elements_sites. Set status to 1. The query runs OK. In the cp is also everything fine but entries don'...
0
votes
0answers
26 views

Optimising search query

I was wondering if there is a better way to do a query like this, it takes a long time to execute and I know setting the parent variable is where there's a problem but am not sure of an alternative ...
0
votes
0answers
10 views

Sort entry query by their table of values if said values are in a separate array of values

Morning (in the UK at least) - I'm trying to sort/order/filter an entry query by an array of values. The array is a list of IDs (e.g. [2,7,8]), and inside each entry is a table with a list of IDs that ...
0
votes
0answers
15 views

Front End get category group from uid

I have a form on the front end which has a category field. I want to display all the options from the category group, by obtaining the categories from the category group. When i dump the properties ...
0
votes
0answers
18 views

Query Events by Matrix Field using Where clause

I am new to Craft CMS. I am able to get a list off all upcoming events with: $events = Calendar::getInstance()->events ->getEventQuery( [ 'calendar' => 'sample_calendar', ...
0
votes
0answers
50 views

Custom Elements + Joins

I'm having a bit of trouble wrapping my head around an SQL issue with a custom Element. One column in my Element's table—for the case of this question, let's call it myplugin_things—has a foreign key ...
0
votes
0answers
9 views

Output category hierarchy in Element API

I am looking to output categories in a level hierarchical format. I have multiple categories, with different levels of categories. Entries can be related to different levels of those categories. ...