/**
  * Removes all customer unit test entries
  *
  * @param \Aimeos\MShop\Common\Manager\Iface $customerManager Customer manager
  * @param \Aimeos\MShop\Common\Manager\Iface $customerAddressManager Customer address manager
  */
 protected function cleanupCustomerData(\Aimeos\MShop\Common\Manager\Iface $customerManager, \Aimeos\MShop\Common\Manager\Iface $customerAddressManager)
 {
     $search = $customerManager->createSearch();
     $search->setConditions($search->compare('=~', 'customer.code', 'unitCustomer'));
     $customerItems = $customerManager->searchItems($search);
     $search = $customerAddressManager->createSearch();
     $search->setConditions($search->compare('=~', 'customer.address.email', 'unitCustomer'));
     $addressItems = $customerAddressManager->searchItems($search);
     $customerAddressManager->deleteItems(array_keys($addressItems));
     $customerManager->deleteItems(array_keys($customerItems));
 }
Ejemplo n.º 2
0
 /**
  * Removes the list items for the given reference IDs
  *
  * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
  * @param array $listItems Associative list of the reference IDs as keys and the list items as values
  * @param array $ids List of referenced IDs
  */
 protected function deleteItems(\Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids)
 {
     $listIds = array();
     foreach ($ids as $id) {
         if (isset($listItems[$id])) {
             $listIds[] = $listItems[$id]->getId();
         }
     }
     $manager->deleteItems($listIds);
 }