Answers.Body: <p>Just a few side notes: </p>
  
  <ol>
  <li>neither the first <code>entries</code> variable nor the second <code>entries</code> variable is an array - both are objects of kind <code>craft\elements\db\EntryQuery</code> (or <code>craft\ElementCriteriaModel</code> if it's Craft 2).</li>
  <li><code>.search('nonMembers:0')</code> can be shortened to <code>nonMembers(0)</code> (or <code>"0"</code> or <code>"not 1"</code> depending on the type) and <code>search('membersExclusive:1')</code> to <code>membersExclusive(1)</code> it will increase your performance as well</li>
  </ol>
  
  <p>So far about that.. You can merge arrays in Twig via <a href="https://twig.symfony.com/doc/2.x/filters/merge.html" rel="nofollow noreferrer">|merge</a> filter</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set values = [1, 2] %}
  
  {% set values = values|merge(['apple', 'orange']) %}
  
  {# values now contains [1, 2, 'apple', 'orange'] #}
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>To address your case specifically, you'll need something like this...</p>
  
  <pre><code>{% set entriesOne = craft.entries.section('publications').search('nonMembers:0').find() %}
  {% set entriesTwo = craft.entries.section('improveYourClub').search('membersExclusive:1').find() %}
  
  {% set allEntries = entriesOne|merge(entriesTwo) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-27T17:24:51.910Z
Answers.Text: In that case how do I merge the two objects
Answers.UserDisplayName: CreateSean
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-27T17:27:14.110Z
Answers.Text: You can't merge objects. You can only merge the results of both queries
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-27T19:41:31.670Z
Answers.Text: @CreateSean What Robin is saying is, add a `.find()` to the end of both queries. Then you'll have arrays of elements (instead of ElementCriteriaModels).
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-28T17:49:01.453Z
Answers.Text: adding .find() returns a php notice with an Array to string conversion error. I had already tried that.
Answers.UserDisplayName: CreateSean
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-28T21:06:54.947Z
Answers.Text: @CreateSean Just edited Robin's answer to use your specific code... give that a shot.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-30T12:14:00.093Z
Answers.Text: @lindsey I updated the post and continue to have array to string errors.
Answers.UserDisplayName: CreateSean
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-30T12:33:10.420Z
Answers.Text: Could you maybe post your entire code? I guess the error is somewhere else
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-27T16:59:46.680Z
Answers.LastActivityDate: 2018-08-28T21:06:22.667Z
Answers.LastEditDate: 2018-08-28T21:06:22.667Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I have these to arrays that I need to merge into one array, but can't figure it out.</p>
  
  <p>Please advise</p>
  
  <pre><code>{% set entries = craft.entries.section('publications').search('nonMembers:0') %}
  
  {% set entries = craft.entries.section('improveYourClub').search('membersExclusive:1') %}
  </code></pre>
  
Tags: <merge><craft2>
Title: Merging 2 Entries Array's
ThreadText: # Merging 2 Entries Array's
  
  (Asked by: username_0 on 2018-08-27)
  
  I have these to arrays that I need to merge into one array, but can't figure it out.
  
  Please advise
  
  ```
  {% set entries = craft.entries.section('publications').search('nonMembers:0') %}
  
  {% set entries = craft.entries.section('improveYourClub').search('membersExclusive:1') %}
  
  ```
  
  **Tags:** merge, craft2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-27. Score: 5
  
  Just a few side notes:
  
  1. neither the first `entries` variable nor the second `entries` variable is an array - both are objects of kind `craft\elements\db\EntryQuery` (or `craft\ElementCriteriaModel` if it's Craft 2).
  2. `.search('nonMembers:0')` can be shortened to `nonMembers(0)` (or `"0"` or `"not 1"` depending on the type) and `search('membersExclusive:1')` to `membersExclusive(1)` it will increase your performance as well
  
  So far about that.. You can merge arrays in Twig via [|merge](https://twig.symfony.com/doc/2.x/filters/merge.html) filter
  
  ```twig
  {% set values = [1, 2] %}
  
  {% set values = values|merge(['apple', 'orange']) %}
  
  {# values now contains [1, 2, 'apple', 'orange'] #}
  
  ```
  
  ---
  
  **EDIT:**
  
  To address your case specifically, you'll need something like this...
  
  ```
  {% set entriesOne = craft.entries.section('publications').search('nonMembers:0').find() %}
  {% set entriesTwo = craft.entries.section('improveYourClub').search('membersExclusive:1').find() %}
  
  {% set allEntries = entriesOne|merge(entriesTwo) %}
  
  ```
  
  > **Comments:**
  > **username_0**: In that case how do I merge the two objects  
  > **username_1**: You can't merge objects. You can only merge the results of both queries  
  > **username_2**: @username_0 What username_1 is saying is, add a `.find()` to the end of both queries. Then you'll have arrays of elements (instead of ElementCriteriaModels).  
  > **username_0**: adding .find() returns a php notice with an Array to string conversion error. I had already tried that.  
  > **username_2**: @username_0 Just edited username_1's answer to use your specific code... give that a shot.  
  > **username_0**: @username_2 I updated the post and continue to have array to string errors.  
  > **username_1**: Could you maybe post your entire code? I guess the error is somewhere else  
  
  ---
  
  