Beispiel #1
0
 /**
  * @param TblBasket $tblBasket
  *
  * @return bool
  */
 public function actionDestroyTempInvoice(TblBasket $tblBasket)
 {
     if ($tblBasket !== null) {
         $Manager = $this->Connection->getEntityManager();
         /** @var  TblTempInvoice[] $EntityList */
         $EntityList = $Manager->getEntity('TblTempInvoice')->findBy(array(TblTempInvoice::ATTR_SERVICE_BILLING_BASKET => $tblBasket->getId()));
         foreach ($EntityList as $Entity) {
             $EntitySubList = $Manager->getEntity('TblTempInvoiceCommodity')->findBy(array(TblTempInvoiceCommodity::ATTR_TBL_TEMP_INVOICE => $Entity->getId()));
             foreach ($EntitySubList as $SubEntity) {
                 Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $SubEntity);
                 $Manager->bulkKillEntity($SubEntity);
             }
             Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $Entity);
             $Manager->bulkKillEntity($Entity);
         }
         $Manager->flushCache();
         return true;
     }
     return false;
 }