Answers.Body: <p>From the docs:</p>
  
  <blockquote>
    <p>Treating your ElementCriteriaModel object as an array will get it to act like one, too. (No find() necessary!)</p>
  </blockquote>
  
  <p>See the fourth point <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements" rel="nofollow">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T12:36:10.463Z
Answers.Text: But in what cases do I need the model and in what the fetched elements? For example pagination needs the model. -- And if it gets added automatically does that mean that I never need to add .find() ? (Assuming I don't pass parameters in it)
Answers.UserDisplayName: Victor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T12:44:04.613Z
Answers.Text: I'm not completely sure of all the different cases but I know that when using `relatedTo()` you can just give it the model. I think most of the times you can actually do both, maybe pagination is a one off here (@bradbell or @brandonkelly will know more). Its certainly worth playing with in various cases though as in one example I found using `.ids()` over just the model was a significant performance increase.
Answers.UserDisplayName: Josh Angell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T12:14:49.517Z
Answers.LastActivityDate: 2014-06-18T12:14:49.517Z
Answers.UserDisplayName: Josh Angell
Answers.Body: <p>The <code>ElementCriteriaModel</code> and the individual element models (like the <code>EntryModel</code>) can be thought of as two different points of time in retrieving data from your database. Essentially, you'll use an <code>ElementCriteriaModel</code> before the database is queried and the element models afterwards.</p>
  
  <blockquote>
    <p>Why do I sometimes have to fetch elements with <code>.first()</code>, <code>.last()</code>, <code>.find()</code>…</p>
  </blockquote>
  
  <p>The <code>ElementCriteriaModel</code> does what it says on the tin — it specifies criteria to find elements. When you call <code>.find()</code>, <code>.first()</code> or <code>.last()</code>, the model sends itself off to the <code>ElementsService</code> which will return element models, based on your criteria.</p>
  
  <blockquote>
    <p>…and in other cases the ElementCriteriaModel is enough?</p>
  </blockquote>
  
  <p>Internally, Craft is using <code>ElementCriteriaModels</code> to work things out. For pagination or the <code>.getPrev()</code> example, Craft is finding elements using the same criteria, but it's using it in a different way to <code>.find()</code> or similar methods.</p>
  
  <p>You <em>can</em> omit the <code>.find()</code> method and treat the <code>ElementCriteriaModel</code> as an array, but it depends on your scenario. As was touched on <a href="https://craftcms.stackexchange.com/questions/59/what-are-the-most-common-template-performance-gotchas-to-avoid/">here</a>, there are performance impacts to consider.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T14:43:11.037Z
Answers.Text: Definitely a better answer...I'm voting for yours!
Answers.UserDisplayName: Josh Angell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T14:46:48.593Z
Answers.Text: Elegant and succinct. Great answer!
Answers.UserDisplayName: Matt Stein
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T13:30:24.763Z
Answers.LastActivityDate: 2014-06-18T16:15:34.620Z
Answers.LastEditDate: 2017-04-13T12:51:00.303Z
Answers.UserDisplayName: Stuart Whitehead
Body: <p>I am a little confused about the differences between an <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel">elementCriteriaModel</a> and fetched elements.</p>
  
  <p>Why do I sometimes have to fetch elements with <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements"><code>first()</code>, <code>last()</code>, <code>find()</code></a>:</p>
  
  <pre><code>{% set entries = craft.entries.section('cocktails').find() %}
  </code></pre>
  
  <p>and in other cases the <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel">elementCriteriaModel</a> is enough:</p>
  
  <pre><code>{% set params = craft.entries.section('cocktails') %}
  {% set prev   = entry.getPrev(params) %}
  </code></pre>
  
Tags: <entries><elementcriteriamodel>
Title: What are the differences between an elementCriteriaModel and fetched elements?
ThreadText: # What are the differences between an elementCriteriaModel and fetched elements?
  
  (Asked by: username_0 on 2014-06-18)
  
  I am a little confused about the differences between an [elementCriteriaModel](http://buildwithcraft.com/docs/templating/elementcriteriamodel) and fetched elements.
  
  Why do I sometimes have to fetch elements with [`first()`, `last()`, `find()`](http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements):
  
  ```
  {% set entries = craft.entries.section('cocktails').find() %}
  
  ```
  
  and in other cases the [elementCriteriaModel](http://buildwithcraft.com/docs/templating/elementcriteriamodel) is enough:
  
  ```
  {% set params = craft.entries.section('cocktails') %}
  {% set prev   = entry.getPrev(params) %}
  
  ```
  
  **Tags:** entries, elementcriteriamodel
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-18. Score: 19 | Accepted answer
  
  The `ElementCriteriaModel` and the individual element models (like the `EntryModel`) can be thought of as two different points of time in retrieving data from your database. Essentially, you'll use an `ElementCriteriaModel` before the database is queried and the element models afterwards.
  
  > Why do I sometimes have to fetch elements with `.first()`, `.last()`, `.find()`…
  
  The `ElementCriteriaModel` does what it says on the tin — it specifies criteria to find elements. When you call `.find()`, `.first()` or `.last()`, the model sends itself off to the `ElementsService` which will return element models, based on your criteria.
  
  > …and in other cases the ElementCriteriaModel is enough?
  
  Internally, Craft is using `ElementCriteriaModels` to work things out. For pagination or the `.getPrev()` example, Craft is finding elements using the same criteria, but it's using it in a different way to `.find()` or similar methods.
  
  You *can* omit the `.find()` method and treat the `ElementCriteriaModel` as an array, but it depends on your scenario. As was touched on [here](https://craftcms.stackexchange.com/questions/59/what-are-the-most-common-template-performance-gotchas-to-avoid/), there are performance impacts to consider.
  
  > **Comments:**
  > **username_1**: Definitely a better answer...I'm voting for yours!  
  > **username_3**: Elegant and succinct. Great answer!  
  
  ---
  
  ### Answer by username_1 on 2014-06-18. Score: 2
  
  From the docs:
  
  > Treating your ElementCriteriaModel object as an array will get it to act like one, too. (No find() necessary!)
  
  See the fourth point [here](http://buildwithcraft.com/docs/templating/elementcriteriamodel#outputting-elements).
  
  > **Comments:**
  > **username_0**: But in what cases do I need the model and in what the fetched elements? For example pagination needs the model. -- And if it gets added automatically does that mean that I never need to add .find() ? (Assuming I don't pass parameters in it)  
  > **username_1**: I'm not completely sure of all the different cases but I know that when using `relatedTo()` you can just give it the model. I think most of the times you can actually do both, maybe pagination is a one off here (@bradbell or @brandonkelly will know more). Its certainly worth playing with in various cases though as in one example I found using `.ids()` over just the model was a significant performance increase.  
  
  ---
  
  