Skip to content

EspoCRM – Open Source CRM Application

orm percistance exception

Yuriia8670b13a2fa
diff --git a/application/Espo/Core/Hook/Hook/BeforeSave.php b/application/Espo/Core/Hook/Hook/BeforeSave.php
index c0a7688087..fb56fdbf7c 100644
--- a/application/Espo/Core/Hook/Hook/BeforeSave.php
+++ b/application/Espo/Core/Hook/Hook/BeforeSave.php
@@ -30,6 +30,7 @@
namespace Espo\Core\Hook\Hook;
use Espo\ORM\Entity;
+use Espo\ORM\Exceptions\PersistenceException;
use Espo\ORM\Repository\Option\SaveOptions;
/**
@@ -44,6 +45,7 @@ interface BeforeSave
*
* @param TEntity $entity An entity.
* @param SaveOptions $options Save options.
+ * @throws PersistenceException
*/
public function beforeSave(Entity $entity, SaveOptions $options): void;
}
diff --git a/application/Espo/ORM/Exceptions/PersistenceException.php b/application/Espo/ORM/Exceptions/PersistenceException.php
new file mode 100644
index 0000000000..29388ff43b
--- /dev/null
+++ b/application/Espo/ORM/Exceptions/PersistenceException.php
@@ -0,0 +1,40 @@
+<?php
+/************************************************************************
+ * This file is part of EspoCRM.
+ *
+ * EspoCRM – Open Source CRM application.
+ * Copyright (C) 2014-2026 EspoCRM, Inc.
+ * Website: https://www.espocrm.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU Affero General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
+ ************************************************************************/
+
+namespace Espo\ORM\Exceptions;
+
+use RuntimeException;
+
+/**
+ * For errors within save, remove, link, unlink processes.
+ *
+ * @since 9.4.0
+ */
+class PersistenceException extends RuntimeException
+{}
diff --git a/application/Espo/ORM/Exceptions/ValidationException.php b/application/Espo/ORM/Exceptions/ValidationException.php
index 2ae663b6f8..43b5e39725 100644
--- a/application/Espo/ORM/Exceptions/ValidationException.php
+++ b/application/Espo/ORM/Exceptions/ValidationException.php
@@ -29,12 +29,10 @@
namespace Espo\ORM\Exceptions;
-use RuntimeException;
-
/**
* A low level validation error.
*
* @since 9.4.0
*/
-class ValidationException extends RuntimeException
+class ValidationException extends PersistenceException
{}