Answers.Body: <p>It's up to you what you prefer to use. Usually people use the <code>ElementCriteriaModel</code>. You could achieve your goal with the record itself too but it requires more code.</p>
  
  <p>The <code>ElementCriteriaModel</code> provides more ready-to-use options and returns populated entries, <code>Records</code> provide only records, so no populated entries with all relations and such</p>
  
  <p>I'm not sure what that <code>$model-&gt;limit</code> is supposed to do, maybe this is a setting in your globals, but you would normally search for entries that contains something (you can find the rules <a href="https://craftcms.com/docs/searching" rel="nofollow noreferrer">here</a>) with this code</p>
  
  <pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
  $criteria-&gt;search = 'yourKeyWord';
  $relaventContent = $criteria-&gt;find();
  </code></pre>
  
  <p>If you just want to have all entries you would do</p>
  
  <pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
  $criteria-&gt;limit = null;
  $relaventContent = $criteria-&gt;find();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-11T11:02:47.450Z
Answers.LastActivityDate: 2017-11-11T11:08:29.140Z
Answers.LastEditDate: 2017-11-11T11:08:29.140Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I am creating a more robust find and replace plugin which shows what is being replaced and where. I need to query for all entries(or content records?) where content is like '%findme%'. </p>
  
  <p>Should I query for entries or should I query for content records for this find and replace?</p>
  
  <p>I saw that there is an <code>EntryRecord</code>, so I can give it CDBCriteria object to find but there is no <code>ContentRecord</code> so how do I get the content with the string in it? </p>
  
  <p>This is all I have so far. </p>
  
  <pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
  $criteria-&gt;limit = $model-&gt;limit;
  $relaventContent = ContentService::model()-&gt;findAll($criteria);
  </code></pre>
  
Tags: <plugin-development><entries><database>
Title: Get entries which have content like '%findme%'
ThreadText: # Get entries which have content like '%findme%'
  
  (Asked by: username_0 on 2017-11-10)
  
  I am creating a more robust find and replace plugin which shows what is being replaced and where. I need to query for all entries(or content records?) where content is like '%findme%'.
  
  Should I query for entries or should I query for content records for this find and replace?
  
  I saw that there is an `EntryRecord`, so I can give it CDBCriteria object to find but there is no `ContentRecord` so how do I get the content with the string in it?
  
  This is all I have so far.
  
  ```
  $criteria = craft()->elements->getCriteria(ElementType::Entry);
  $criteria->limit = $model->limit;
  $relaventContent = ContentService::model()->findAll($criteria);
  
  ```
  
  **Tags:** plugin-development, entries, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-11-11. Score: 1
  
  It's up to you what you prefer to use. Usually people use the `ElementCriteriaModel`. You could achieve your goal with the record itself too but it requires more code.
  
  The `ElementCriteriaModel` provides more ready-to-use options and returns populated entries, `Records` provide only records, so no populated entries with all relations and such
  
  I'm not sure what that `$model->limit` is supposed to do, maybe this is a setting in your globals, but you would normally search for entries that contains something (you can find the rules [here](https://craftcms.com/docs/searching)) with this code
  
  ```
  $criteria = craft()->elements->getCriteria(ElementType::Entry);
  $criteria->search = 'yourKeyWord';
  $relaventContent = $criteria->find();
  
  ```
  
  If you just want to have all entries you would do
  
  ```
  $criteria = craft()->elements->getCriteria(ElementType::Entry);
  $criteria->limit = null;
  $relaventContent = $criteria->find();
  
  ```
  
  
  ---
  
  