/** * Removes all customer unit test entries * * @param MShop_Common_Manager_Interface $customerManager Customer manager * @param MShop_Common_Manager_Interface $customerAddressManager Customer address manager */ protected function _cleanupCustomerData(MShop_Common_Manager_Interface $customerManager, MShop_Common_Manager_Interface $customerAddressManager) { $search = $customerManager->createSearch(); $search->setConditions($search->compare('==', 'customer.website', 'unittest.aimeos.org')); $customerItems = $customerManager->searchItems($search); $search = $customerAddressManager->createSearch(); $search->setConditions($search->compare('==', 'customer.address.website', 'unittest.aimeos.org')); $addressItems = $customerAddressManager->searchItems($search); $customerAddressManager->deleteItems(array_keys($addressItems)); $customerManager->deleteItems(array_keys($customerItems)); }
/** * Optionally first remove all suggested products from product list. * * @param int $productId Product id * @param int $listTypeId Product list type id * @param MShop_Common_Manager_Interface $productListManager Manager for list types of product domain */ protected function _removeProductSuggestions($productId, $listTypeId, MShop_Common_Manager_Interface $productListManager) { $search = $productListManager->createSearch(); $expr = array($search->compare('==', 'product.list.parentid', $productId), $search->compare('==', 'product.list.type.id', $listTypeId)); $search->setConditions($search->combine('&&', $expr)); $listItems = $productListManager->searchItems($search); $productListManager->deleteItems(array_keys($listItems)); }