/**
  * Deletes an existing record
  *
  * @return void
  */
 public function deleteAction()
 {
     // Check permission
     if ($this->settings['enableDeleting']) {
         // Get $_POST parameters
         $arguments = $this->request->getArguments();
         $confirmed = FALSE;
         // Assign headline to view
         $languageUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\LanguageUtility');
         $this->view->assign('headline', $languageUtility->translateValue($this->settings['headlineDeleting']));
         // Check if delete is confirmed
         if (isset($arguments['confirmed'])) {
             $confirmed = TRUE;
             // Set Table names
             $tables = explode(',', $this->settings['tables']);
             // Get primary key(s) of the record
             if (isset($arguments['primaryKeys'])) {
                 $primaryKeys = $arguments['primaryKeys'];
             } else {
                 $primaryKeys = NULL;
             }
             // Data for post-processing SQL
             $data = array();
             if (isset($primaryKeys)) {
                 foreach ($primaryKeys as $column => $value) {
                     $data[$column]['value'] = $value;
                 }
             }
             $deleteRecord = TRUE;
             // Include hook to do something before record deletion
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ezqueries']['recordManagementController']['hookBeforeDelete'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ezqueries']['recordManagementController']['hookBeforeDelete'] as $_classRef) {
                     $_procObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     $deleteRecord = $_procObj->hookBeforeDelete($data, $primaryKeys, $tables[0]);
                 }
             }
             if ($deleteRecord === TRUE) {
                 // Delete the record
                 $status = $this->recordManagementRepository->deleteRecord($tables[0], $primaryKeys);
             } else {
                 $status = $deleteRecord;
             }
             // Include hook to do something after record deletion
             if ($status == 'success') {
                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ezqueries']['recordManagementController']['hookAfterDelete'])) {
                     foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ezqueries']['recordManagementController']['hookAfterDelete'] as $_classRef) {
                         $_procObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                         $_procObj->hookAfterDelete($data, $primaryKeys, $tables[0]);
                     }
                 }
             }
             // Post-processing SQL
             if ($status == 'success' && isset($this->settings['postProcessingDeletingSQL'])) {
                 $templateUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\TemplateUtility');
                 $postProcessingSQLStatements = explode(';', $this->settings['postProcessingDeletingSQL']);
                 $postProcessingSQLStatusTotal = '';
                 foreach ($postProcessingSQLStatements as $postProcessingSQLStatement) {
                     if ($postProcessingSQLStatement !== '') {
                         $parsedPostProcessingSQLStatement = $templateUtility->fillMarkersInSQLStatement(trim($postProcessingSQLStatement), $arguments, $data);
                         $postProcessingSQLStatus = $this->recordManagementRepository->executeSQLStatement($parsedPostProcessingSQLStatement);
                         if ($postProcessingSQLStatus !== 'success') {
                             $postProcessingSQLStatusTotal .= '<br />Post-processing error: ' . $postProcessingSQLStatus;
                         }
                     }
                 }
             }
             // Show create status
             switch ($status) {
                 case 'success':
                     $flashMessage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('message_delete_successful', 'ezqueries') . $postProcessingSQLStatusTotal;
                     break;
                 default:
                     $flashMessage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('message_error', 'ezqueries') . ' "' . $status . '"';
                     $status = 'error';
                     // Redirect to delete view
                     $this->redirect('delete', NULL, NULL, array('status' => $status, 'flashMessage' => $flashMessage));
                     break;
             }
         } else {
             // Set FlashMessage
             if (isset($arguments['flashMessage'])) {
                 $flashMessage = $arguments['flashMessage'];
             } else {
                 $flashMessage = '';
             }
             // Set Status
             if (isset($arguments['status'])) {
                 if ($arguments['status'] == 'error') {
                     $this->view->assign('error', 'true');
                 }
             }
             // Assign search arguments to view
             if (isset($arguments['search'])) {
                 $search = $arguments['search'];
             } else {
                 $search = array();
             }
             $this->view->assign('search', $search);
             // Assign filter arguments to view
             if (isset($arguments['filters'])) {
                 $filters = $arguments['filters'];
             } else {
                 $filters = array();
             }
             $this->view->assign('filters', $filters);
             // Get primary key(s) of the record and assign to view
             if (isset($arguments['primaryKeys'])) {
                 $primaryKeys = $arguments['primaryKeys'];
             } else {
                 $primaryKeys = NULL;
             }
             $this->view->assign('primaryKeys', $primaryKeys);
         }
         // Is confirmed
         $this->view->assign('confirmed', $confirmed);
         // Assign flash message to view
         $this->view->assign('flashMessage', $flashMessage);
     } else {
         $this->redirect('error');
     }
 }