EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
FieldDuplicator use template
Yuriic4d690feb8be
diff --git a/application/Espo/Classes/FieldDuplicators/DashboardTemplate/Layout.php b/application/Espo/Classes/FieldDuplicators/DashboardTemplate/Layout.phpindex 09d022ace0..3cbf67e4a5 100644--- a/application/Espo/Classes/FieldDuplicators/DashboardTemplate/Layout.php+++ b/application/Espo/Classes/FieldDuplicators/DashboardTemplate/Layout.php@@ -34,19 +34,17 @@ use Espo\Core\Utils\ObjectUtil;use Espo\Core\Utils\Util;use Espo\Entities\DashboardTemplate;use Espo\ORM\Entity;-use UnexpectedValueException;use LogicException;use RuntimeException;use stdClass;+/**+ * @implements FieldDuplicator<DashboardTemplate>+ */class Layout implements FieldDuplicator{public function duplicate(Entity $entity, string $field): stdClass{- if (!$entity instanceof DashboardTemplate) {- throw new UnexpectedValueException();- }-$layout = $entity->getLayoutRaw();$options = $entity->getDashletsOptionsRaw();diff --git a/application/Espo/Core/Record/Duplicator/FieldDuplicator.php b/application/Espo/Core/Record/Duplicator/FieldDuplicator.phpindex 2c1493c9df..4237ac9891 100644--- a/application/Espo/Core/Record/Duplicator/FieldDuplicator.php+++ b/application/Espo/Core/Record/Duplicator/FieldDuplicator.php@@ -36,8 +36,13 @@ use stdClass;/*** Duplicates attributes of a field. Some fields can require some processing* when an entity is being duplicated.+ *+ * @template TEntity of Entity = Entity*/interface FieldDuplicator{+ /**+ * @param TEntity $entity+ */public function duplicate(Entity $entity, string $field): stdClass;}