Check that a destroy attribute has been defined.

@return void
@throws \ErrorException
495200
protected function checkDestroyAttributesDefinition(): void
    {
        if ($this->isRouteDefined('destroy') && $this->getAttribute('destroyAttributes')->isEmpty()) {
            $errorMessage = 'No columns have been chosen for the destroy confirmation. '
                            . 'Use the « useForDestroyConfirmation() » method on column objects to define them.';
            throw new ErrorException($errorMessage);
        }
    }
1253262
protected function deleteFile()
    {
        $this->controlAccess('file_delete');

        if ($this->file->deleteAll($this->data_file['file_id'])) {
            $this->redirect('admin/content/file', $this->text('File has been deleted from database and disk'), 'success');
        }

        // Redirect in any case as file can be already deleted from the database
        $this->redirect('admin/content/file', $this->text('An error occurred'), 'warning');
    }
1371479
public function validateCall(): void
    {

        if (! in_array($this->method, ['get', 'post', 'put', 'patch', 'delete']))
            throw new Exception('Invalid HTTP method used');

        if (trim($this->endpoint) === '')
            throw new Exception('Empty endpoint used');

        // Enfore a version specification unless this is a 'meta' call.
        if (trim($this->version) === '' && ! (in_array('meta', $this->tags())))
            throw new Exception('Version is empty');
    }
686650
public function onShutdown()
    {
        // Get the last error if there was one, if not, let's get out of here.
        if (!$error = error_get_last()) {
            return;
        }

        $fatal  = array(E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR,E_USER_ERROR,E_RECOVERABLE_ERROR);
        if (!in_array($error['type'], $fatal)) {
            return;
        }

        $message   = '[Shutdown Error]: %s';
        $message   = sprintf($message, $error['message']);
        $backtrace = array(array('file' => $error['file'], 'line' => $error['line']));

        $this->client->notifyOnError($message, $backtrace, 'error');
        error_log($message.' in: '.$error['file'].':'.$error['line']);
    }
9768
public function clearErrors($attribute = null)
    {
        if ($attribute === null) {
            $this->errors = [];
        } else {
            unset($this->errors[$attribute]);
        }
    }
142530
private function checkDeleteInput()
    {
        
        $defaults = array('language' => null,
        				  'input' => dirname(__FILE__) . '/../../' . $this->options['extension'] . '/' . self::DEF_INPUT_DIR,
        				  'output' => dirname(__FILE__) . '/../../' . $this->options['extension'] . '/' . self::DEF_OUTPUT_DIR,
                          'extension' => null);
        
        $this->options = array_merge($defaults, $this->options);
        
        if (is_null($this->options['extension'])){
        	$this->err("Please provide an 'extension' identifier.", true);
        }else{
            if (is_null($this->options['language'])) {
                $this->err("Please provide a 'language' identifier such as en-US, fr-CA, IT, ...", true);
            } else {
				$this->checkInputOption();
			}
        }
        
    }
691510
public function handleShutdown()
	{
		if ( !is_null( $error = error_get_last() ) && in_array( $error['type'], [
				E_ERROR,
				E_CORE_ERROR,
				E_COMPILE_ERROR,
				E_PARSE
			] )
		)
		{
			$this->handleException( new FatalErrorException( $error['message'], $error['type'], 0, $error['file'], $error['line'], 0 ) );
		}
	}
967602
private function _resetErrorMode()
    {
        // get PDO object and reset the error mode to what it was originally
        $pdo = $this->_getPdo();
        $pdo->setAttribute(PDO::ATTR_ERRMODE, $this->_errMode);
    }
338029
public function onShutdown()
    {
        $error = error_get_last();
        if ($error !== null) {
            $errors = array(
                E_ERROR,
                E_PARSE,
                E_CORE_ERROR,
                E_CORE_WARNING,
                E_COMPILE_ERROR,
                E_COMPILE_WARNING,
                E_STRICT
            );
            if (in_array($error['type'], $errors)) {
                $this->getSentryClient()->captureException(
                    $this->createErrorException($error['message'], $error['type'], $error['file'], $error['line'])
                );
            }
        }
    }
467398
public function hasErrors($attribute = null)
    {
        if (!count($this->_errors)) {
            return false;
        }
        if ($attribute && isset($this->_errors[$attribute]) && count($this->_errors[$attribute])) {
            return true;
        } elseif ($attribute) {
            return false;
        }
        return true;
    }
30019
public function onAfterDelete()
    {
        $bucket = CloudAssets::inst()->map($this->owner->getFilename());
        if ($bucket && !Config::inst()->get('CloudAssets', 'uploads_disabled')) {
            if ($this->owner->hasMethod('onBeforeCloudDelete')) {
                $this->owner->onBeforeCloudDelete();
            }

            try {
                CloudAssets::inst()->getLogger()->info("CloudAssets: deleting {$this->owner->getFilename()}");
                $bucket->delete($this->owner);
            } catch (Exception $e) {
                CloudAssets::inst()->getLogger()->error("CloudAssets: Failed bucket delete: " . $e->getMessage() . " for " . $this->owner->getFullPath());
            }

            if ($this->owner->hasMethod('onAfterCloudDelete')) {
                $this->owner->onAfterCloudDelete();
            }
        }
    }
1112938
public function IsErrorDispatched () {
		$toolClass = $this->toolClass;
		$defaultCtrlName = $toolClass::GetDashedFromPascalCase($this->defaultControllerName);
		$errorActionName = $toolClass::GetDashedFromPascalCase($this->defaultControllerErrorActionName);
		return $this->request->GetControllerName() == $defaultCtrlName &&
			$this->request->GetActionName() == $errorActionName;
	}
1225124
public function hasChanged(): bool
    {
        return ! (empty($this->addAttributes) && empty($this->updateAttributes) && empty($this->removeAttributes));
    }
704188
protected function defineErrorHandler()
    {
        $errorRender = $this->obtainErrorRender();
        
        //If not render to use
        if ($errorRender === false) {
            return;
        }

        //add the handler for errors
        set_error_handler([$this, 'errorHandler']);
        
        \BFW\Application::getInstance()
            ->getMonolog()
            ->getLogger()
            ->debug('New error handler defined.')
        ;
    }
794295
public function cmdDeleteStore()
    {
        $id = $this->getParam(0);

        if (empty($id) || !is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if (!$this->store->delete($id)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
405819
public function beforeDelete()
    {
        foreach ($this->attributes as $attr => $options) {
            $this->ensureAttribute($attr, $options);
            $this->deleteFiles($attr);
        }
    }
463354
public function beforeValidate()
    {
        foreach ($this->attributes as $attribute) {
            $this->owner->$attribute = HtmlPurifier::process($this->owner->$attribute, $this->config);
        }
    }