Get related entries in plugin via Entries field type I have 2 sections: Gift Cards and Merchants.

In Gift Cards, I have a entries field that is limited to the Merchants section and limited to 1 selection. 

In Merchants, I have a field merchantId that is a plaintextfield.

In my plugin, I would like to return all gift cards that have a merchantId of 123.  I've tried a few different ways, but all ways have either given no results or I get a 'missing index Merchant' error in the FieldServices class. 

Hopefully someone here has done something similar and can point me in the right direction.
First, you should get all the Merchant Entries with the merchantId of 123

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section('merchants');
$criteria-&gt;merchantId = '123';

$merchants = $criteria-&gt;find();


Next, find all Gift Card entries that are related to the found merchants.

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'giftCards';
$criteria-&gt;relatedTo = array(
    'targetElement' =&gt; $merchants,
    'field' =&gt; 'YOUR-ENTRIES-FIELD'
);

$gift_cards = $criteria-&gt;find();