Answers.Body: <p>For instance like this:</p>
  
  <pre><code>$entries = Entry::find()
      -&gt;section('sectionName')
      -&gt;orderBy('fieldName')
      -&gt;limit(null)
      -&gt;all();
  </code></pre>
  
  <p>Have a look here in the documentation (for the code examples you can toggle Twig and PHP view for code examples):
  <a href="https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html" rel="noreferrer">https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html</a></p>
  
  <p>Note that if you add <code>use craft\elements\Entry;</code> to the top of your plugin file, you can use the <code>Entry::find()</code> directly, you don't need the namespace prefix like in the examples in the documentation (for instance <code>\craft\elements\Entry::find();</code>).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-31T09:05:31.447Z
Answers.LastActivityDate: 2018-08-31T09:05:31.447Z
Answers.UserDisplayName: KSP
Body: <p>I am creating custom search based on entries. I need to fetch entries in custom plugin.</p>
  
Tags: <plugin-development><craft3><search>
Title: How to fetch entries in custom plugin Craft 3?
ThreadText: # How to fetch entries in custom plugin Craft 3?
  
  (Asked by: username_0 on 2018-08-31)
  
  I am creating custom search based on entries. I need to fetch entries in custom plugin.
  
  **Tags:** plugin-development, craft3, search
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-31. Score: 10 | Accepted answer
  
  For instance like this:
  
  ```
  $entries = Entry::find()
      ->section('sectionName')
      ->orderBy('fieldName')
      ->limit(null)
      ->all();
  
  ```
  
  Have a look here in the documentation (for the code examples you can toggle Twig and PHP view for code examples):
  <https://docs.craftcms.com/v3/dev/element-queries/entry-queries.html>
  
  Note that if you add `use craft\elements\Entry;` to the top of your plugin file, you can use the `Entry::find()` directly, you don't need the namespace prefix like in the examples in the documentation (for instance `\craft\elements\Entry::find();`).
  
  
  ---
  
  