Entries search query by 2 custom fields So I have a Entry type that has two custom fields on it. Both fields are integer fields. I'd like to make a query in PHP that gets the entries by two custom fields, both of which are integer values. Here is my code so far:

    $query = [
        'year' =&gt; $year,
        'quarter' =&gt; $quarter,
    ];
    $seasonBoxes = \craft\elements\Entry::find()
                 -&gt;section('boxes')
                 -&gt;search($query)
                 -&gt;orderBy('dateCreated asc')
                 -&gt;all();


Please note: $year is independent of the entry creation date so I can't use the date filters.
Fields in craft that are not element is query by something called element criteria model.
In twig you do:

{% set result = craft.entries({
       section: 'boxes'
       orderBy: 'dateCreated asc'
       year: year,
       quarter： quarter
}).all() %}


In php

 $query = [
        'year' =&gt; $year,
        'quarter' =&gt; $quarter,
    ];
 $seasonBoxesQueryObject = \craft\elements\Entry::find()
                 -&gt;section('boxes')
                 -&gt;orderBy('dateCreated asc');
 $seasonBoxesQueryObject-&gt;year = $query['year'];
 $seasonBoxesQueryObject-&gt;quarter = $query['quarter'];
 $seasonBoxes = $seasonBoxesQueryObject-&gt;all();