Answers.Body: <p>I haven't tried this in php, but on the 'template' side there is an attribute called 'status' which you might try. I assume it would work in php as well.</p>
  
  <pre><code>$existing = craft()-&gt;elements-&gt;getCriteria($this-&gt;entry-&gt;elementType)-&gt;first(array(
      'someHandle' =&gt; 'someValue', 
      'status' =&gt; null
  ));
  </code></pre>
  
  <p>Default is 'live'; other values would be 'live', 'pending', 'expired', 'disabled', and null. Here's the docs for <a href="http://buildwithcraft.com/docs/templating/craft.entries#status" rel="nofollow">craft.entries.status</a>. Let us know if it works.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-31T19:30:43.983Z
Answers.Text: What Douglas said. There’s actually no `enabled` criteria parameter; only `status`. Setting it to `null` will prevent the elements’ statuses from getting factored into the query.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-12T21:57:27.877Z
Answers.Text: Thanks guys. A follow up though - I can see I can use null to get ALL, but if I only want live and pending, how do I do that? In PHP.
Answers.UserDisplayName: Russ Back
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-12T22:31:59.727Z
Answers.Text: Again, on the backend I'm not 100% sure, but I think that you can simply place all the options in an array like so: `'status' => ['live', 'pending']` or you might also try `'status' => ['and', 'live', 'pending']` or perhaps `'status' => array('and', 'live', 'pending')`.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-12T22:51:31.293Z
Answers.Text: If [this answer](http://craftcms.stackexchange.com/questions/1680/how-can-you-return-elements-between-two-values/1683#1683) is any indication it should be the latter `'status' => array('and', 'live', 'pending')`
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-15T00:40:15.713Z
Answers.LastActivityDate: 2014-12-15T00:40:15.713Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>Within a plugin I am fetching existing entries using the CriteriaModel class as documented here <a href="http://buildwithcraft.com/docs/plugins/working-with-elements#fetching-elements" rel="nofollow">http://buildwithcraft.com/docs/plugins/working-with-elements#fetching-elements</a>, specifically like this:</p>
  
  <pre><code>$existing = craft()-&gt;elements-&gt;getCriteria($this-&gt;entry-&gt;elementType)-&gt;first(array(
      'someHandle' =&gt; 'someValue'
  ))
  </code></pre>
  
  <p>However I am finding this only returns a result if an ENABLED entry is found. I can see that I can search for ONE particular enabled state as follows:</p>
  
  <pre><code>$existing = craft()-&gt;elements-&gt;getCriteria($this-&gt;entry-&gt;elementType)-&gt;first(array(
      'someHandle' =&gt; 'someValue', 
      'enabled' =&gt; 1
  ))
  </code></pre>
  
  <p>Or...</p>
  
  <pre><code>$existing = craft()-&gt;elements-&gt;getCriteria($this-&gt;entry-&gt;elementType)-&gt;first(array(
      'someHandle' =&gt; 'someValue', 
      'enabled' =&gt; 0
  ))
  </code></pre>
  
  <p>But how can I search for ALL entries regardless of the enabled state?</p>
  
  <p>And also, what is the difference between the status and enabled properties on the model? I can see constants for ENABLED, DISABLED and ARCHIVED. I'm not clear on how this differs from the boolean value that the enabled property has.</p>
  
Tags: <plugin-development><search><elementcriteriamodel><models>
Title: How can I search for entries that are enabled OR disabled?
ThreadText: # How can I search for entries that are enabled OR disabled?
  
  (Asked by: username_0 on 2014-12-10)
  
  Within a plugin I am fetching existing entries using the CriteriaModel class as documented here <http://buildwithcraft.com/docs/plugins/working-with-elements#fetching-elements>, specifically like this:
  
  ```
  $existing = craft()->elements->getCriteria($this->entry->elementType)->first(array(
      'someHandle' => 'someValue'
  ))
  
  ```
  
  However I am finding this only returns a result if an ENABLED entry is found. I can see that I can search for ONE particular enabled state as follows:
  
  ```
  $existing = craft()->elements->getCriteria($this->entry->elementType)->first(array(
      'someHandle' => 'someValue', 
      'enabled' => 1
  ))
  
  ```
  
  Or...
  
  ```
  $existing = craft()->elements->getCriteria($this->entry->elementType)->first(array(
      'someHandle' => 'someValue', 
      'enabled' => 0
  ))
  
  ```
  
  But how can I search for ALL entries regardless of the enabled state?
  
  And also, what is the difference between the status and enabled properties on the model? I can see constants for ENABLED, DISABLED and ARCHIVED. I'm not clear on how this differs from the boolean value that the enabled property has.
  
  **Tags:** plugin-development, search, elementcriteriamodel, models
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-12-15. Score: 3 | Accepted answer
  
  I haven't tried this in php, but on the 'template' side there is an attribute called 'status' which you might try. I assume it would work in php as well.
  
  ```
  $existing = craft()->elements->getCriteria($this->entry->elementType)->first(array(
      'someHandle' => 'someValue', 
      'status' => null
  ));
  
  ```
  
  Default is 'live'; other values would be 'live', 'pending', 'expired', 'disabled', and null. Here's the docs for [craft.entries.status](http://buildwithcraft.com/docs/templating/craft.entries#status). Let us know if it works.
  
  > **Comments:**
  > **username_2**: What username_1 said. There’s actually no `enabled` criteria parameter; only `status`. Setting it to `null` will prevent the elements’ statuses from getting factored into the query.  
  > **username_0**: Thanks guys. A follow up though - I can see I can use null to get ALL, but if I only want live and pending, how do I do that? In PHP.  
  > **username_1**: Again, on the backend I'm not 100% sure, but I think that you can simply place all the options in an array like so: `'status' => ['live', 'pending']` or you might also try `'status' => ['and', 'live', 'pending']` or perhaps `'status' => array('and', 'live', 'pending')`.  
  > **username_1**: If [this answer](http://craftcms.stackexchange.com/questions/1680/how-can-you-return-elements-between-two-values/1683#1683) is any indication it should be the latter `'status' => array('and', 'live', 'pending')`  
  
  ---
  
  