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.
enabledcriteria parameter; onlystatus. Setting it tonullwill prevent the elements’ statuses from getting factored into the query. – Brandon Kelly Dec 31 '14 at 19:30'status' => ['live', 'pending']or you might also try'status' => ['and', 'live', 'pending']or perhaps'status' => array('and', 'live', 'pending'). – Douglas McDonald Jan 12 '15 at 22:31'status' => array('and', 'live', 'pending')– Douglas McDonald Jan 12 '15 at 22:51