Answers.Body: <p><code>craft.entries</code> now returns an <a href="https://docs.craftcms.com/v3/dev/element-queries/" rel="nofollow noreferrer">ElementQuery</a>. When you add the <code>.all()</code> you're telling Craft to execute the query, which returns an <code>array</code> of Elements.</p>
  
  <p>That means that <code>solutions</code> is now a simple array, and won't have methods like <code>.limit(1)</code> that can be executed on it. It looks like you just want to use the first item in the <code>solutions</code> array, so try changing this:</p>
  
  <pre><code>      {% nav solution in solutions.limit(1) %}
             &lt;a class="nav-link" href="{{ solution.url }}"&gt;solutions&lt;span class="sr-only"&gt;(current)&lt;/span&gt; &lt;i class="icon-downarrow"&gt;&lt;/i&gt; &lt;/a&gt;
        {% endnav %}
  </code></pre>
  
  <p>To this:</p>
  
  <pre><code>       &lt;a class="nav-link" href="{{ solutions[0].url }}"&gt;solutions&lt;span class="sr-only"&gt;(current)&lt;/span&gt; &lt;i class="icon-downarrow"&gt;&lt;/i&gt; &lt;/a&gt;
  </code></pre>
  
  <p>More here: <a href="https://docs.craftcms.com/v3/dev/tags/nav.html" rel="nofollow noreferrer">{% nav %} Tags</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-08T02:11:35.570Z
Answers.LastActivityDate: 2018-11-08T02:11:35.570Z
Answers.UserDisplayName: andrew.welch
Body: <p>I recently upgraded a site from Craft 2 to Craft 3, so I'm trying to figure out what was deprecated and caused this error. </p>
  
  <p>At the top of the page I have this</p>
  
  <pre><code>{% set solutions = craft.entries.section('solutions').level(1).all() %}
  </code></pre>
  
  <p>And I'm trying to invoke a dropdown menu like so </p>
  
  <pre><code>&lt;li class="nav-item {% if craft.request.segment(1) == 'solutions' %}active{% endif %}"&gt;
      {% nav solution in solutions.limit(1) %}
          &lt;a class="nav-link" href="{{ solution.url }}"&gt;solutions&lt;span class="sr-only"&gt;(current)&lt;/span&gt; &lt;i class="icon-downarrow"&gt;&lt;/i&gt; &lt;/a&gt;
      {% endnav %}
      &lt;ul class="submenu"&gt;
          {% nav solution in solutions %}
              &lt;li&gt;
                  &lt;a href="{{ solution.url }}"&gt;{{ solution.title }}&lt;/a&gt;
              &lt;/li&gt;
          {% endnav %}
      &lt;/ul&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Before I didn't have <code>.all()</code> at the end, but only the first menuitem was showing up.
  When I added <code>.all()</code> in, I get the error <code>"Impossible to invoke a method ("limit") on an array."</code></p>
  
Tags: <craft3><craft2>
Title: Impossible to invoke a method ("limit") on an array
ThreadText: # Impossible to invoke a method ("limit") on an array
  
  (Asked by: username_0 on 2018-11-08)
  
  I recently upgraded a site from Craft 2 to Craft 3, so I'm trying to figure out what was deprecated and caused this error.
  
  At the top of the page I have this
  
  ```
  {% set solutions = craft.entries.section('solutions').level(1).all() %}
  
  ```
  
  And I'm trying to invoke a dropdown menu like so
  
  ```
  <li class="nav-item {% if craft.request.segment(1) == 'solutions' %}active{% endif %}">
      {% nav solution in solutions.limit(1) %}
          <a class="nav-link" href="{{ solution.url }}">solutions<span class="sr-only">(current)</span> <i class="icon-downarrow"></i> </a>
      {% endnav %}
      <ul class="submenu">
          {% nav solution in solutions %}
              <li>
                  <a href="{{ solution.url }}">{{ solution.title }}</a>
              </li>
          {% endnav %}
      </ul>
  </li>
  
  ```
  
  Before I didn't have `.all()` at the end, but only the first menuitem was showing up.
  When I added `.all()` in, I get the error `"Impossible to invoke a method ("limit") on an array."`
  
  **Tags:** craft3, craft2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-11-08. Score: 2 | Accepted answer
  
  `craft.entries` now returns an [ElementQuery](https://docs.craftcms.com/v3/dev/element-queries/). When you add the `.all()` you're telling Craft to execute the query, which returns an `array` of Elements.
  
  That means that `solutions` is now a simple array, and won't have methods like `.limit(1)` that can be executed on it. It looks like you just want to use the first item in the `solutions` array, so try changing this:
  
  ```
        {% nav solution in solutions.limit(1) %}
             <a class="nav-link" href="{{ solution.url }}">solutions<span class="sr-only">(current)</span> <i class="icon-downarrow"></i> </a>
        {% endnav %}
  
  ```
  
  To this:
  
  ```
         <a class="nav-link" href="{{ solutions[0].url }}">solutions<span class="sr-only">(current)</span> <i class="icon-downarrow"></i> </a>
  
  ```
  
  More here: [{% nav %} Tags](https://docs.craftcms.com/v3/dev/tags/nav.html)
  
  
  ---
  
  