コード例 #1
0
ファイル: Order.php プロジェクト: shirone/thelia
 /**
  * @param OrderQuery $search
  * @param $searchTerm
  * @param $searchIn
  * @param $searchCriteria
  */
 public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
 {
     $search->_and();
     foreach ($searchIn as $index => $searchInElement) {
         if ($index > 0) {
             $search->_or();
         }
         switch ($searchInElement) {
             case 'ref':
                 $search->filterByRef($searchTerm, $searchCriteria);
                 break;
             case 'invoice_ref':
                 $search->filterByInvoiceRef($searchTerm, $searchCriteria);
                 break;
             case 'customer_ref':
                 $search->filterByCustomer(CustomerQuery::create()->filterByRef($searchTerm, $searchCriteria)->find());
                 break;
             case 'customer_firstname':
                 $search->filterByOrderAddressRelatedByInvoiceOrderAddressId(OrderAddressQuery::create()->filterByFirstname($searchTerm, $searchCriteria)->find());
                 break;
             case 'customer_lastname':
                 $search->filterByOrderAddressRelatedByInvoiceOrderAddressId(OrderAddressQuery::create()->filterByLastname($searchTerm, $searchCriteria)->find());
                 break;
             case 'customer_email':
                 $search->filterByCustomer(CustomerQuery::create()->filterByEmail($searchTerm, $searchCriteria)->find());
                 break;
         }
     }
 }