<?php namespace MailPoet\Form; if (!defined('ABSPATH')) exit; use MailPoet\Entities\FormEntity; use MailPoet\WP\Functions as WPFunctions; use MailPoetVendor\Carbon\Carbon; use MailPoetVendor\Doctrine\ORM\EntityManager; class FormSaveController { /** @var EntityManager */ private $entityManager; /** @var WPFunctions */ private $wp; public function __construct( EntityManager $entityManager, WPFunctions $wp ) { $this->entityManager = $entityManager; $this->wp = $wp; } public function duplicate(FormEntity $formEntity): FormEntity { $duplicate = clone $formEntity; $duplicate->setName(sprintf(__('Copy of %s', 'mailpoet'), $formEntity->getName())); // reset timestamps $now = Carbon::createFromTimestamp($this->wp->currentTime('timestamp')); $duplicate->setCreatedAt($now); $duplicate->setUpdatedAt($now); $duplicate->setDeletedAt(null); $this->entityManager->persist($duplicate); $this->entityManager->flush(); return $duplicate; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Block | Folder | 0755 |
|
|
Listing | Folder | 0755 |
|
|
Templates | Folder | 0755 |
|
|
Util | Folder | 0755 |
|
|
ApiDataSanitizer.php | File | 1.82 KB | 0644 |
|
AssetsController.php | File | 3.38 KB | 0644 |
|
BlockStylesRenderer.php | File | 3.79 KB | 0644 |
|
BlockWrapperRenderer.php | File | 548 B | 0644 |
|
BlocksRenderer.php | File | 3.98 KB | 0644 |
|
DisplayFormInWPContent.php | File | 7.77 KB | 0644 |
|
FormFactory.php | File | 1.69 KB | 0644 |
|
FormHtmlSanitizer.php | File | 1.11 KB | 0644 |
|
FormMessageController.php | File | 1.61 KB | 0644 |
|
FormSaveController.php | File | 1021 B | 0644 |
|
FormsRepository.php | File | 2.52 KB | 0644 |
|
PreviewPage.php | File | 3.91 KB | 0644 |
|
PreviewWidget.php | File | 472 B | 0644 |
|
Renderer.php | File | 4.05 KB | 0644 |
|
Widget.php | File | 8.34 KB | 0644 |
|
index.php | File | 0 B | 0644 |
|