Get entries by category value from within plugin I need help.

I want to get entries based on multiple field search. It works for basic field types like selectbox or plain text but I can't get it to work with Categories Fields.

The field size is a selectbox field and works good.
The color is a Categories field and doesn't work.

The code:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = "houses";
$criteria-&gt;size = "big"; 
$criteria-&gt;color = "white"; // &lt;== HOW???
$entries = craft()-&gt;elements-&gt;buildElementsQuery($criteria)-&gt;queryAll();


How do I get entries with a specific Categories Field value?

Thanks for any help.
Here's another solution which feels more correct. It uses relations and the relatedTo parameter.

// First get the all CategoryModels
$colorCriteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Category);
$colorCriteria-&gt;group = 'colors';
$colorCriteria-&gt;slug = array("white");
$colorCategories = $colorCriteria-&gt;find();

// Then get the entries
$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = "houses";
$criteria-&gt;size = "big";
$criteria-&gt;relatedTo = $colorCategories;//&lt;= Here's the fancy part. 
$entries = craft()-&gt;elements-&gt;buildElementsQuery($criteria)-&gt;queryAll();


Hopefully that helps someone else.