| Server IP : 35.236.43.222 / Your IP : 216.73.216.143 Web Server : Apache System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64 User : deploy ( 1002) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/mastersystem.app/public/wp-content/plugins/mailpoet/lib/Form/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Entities\FormEntity;
use MailPoetVendor\Carbon\Carbon;
use MailPoetVendor\Doctrine\ORM\EntityManager;
class FormSaveController {
/** @var EntityManager */
private $entityManager;
public function __construct(
EntityManager $entityManager
) {
$this->entityManager = $entityManager;
}
public function duplicate(FormEntity $formEntity): FormEntity {
$duplicate = clone $formEntity;
// translators: %s is name of the form which has been duplicated.
$duplicate->setName(sprintf(__('Copy of %s', 'mailpoet'), $formEntity->getName()));
// reset timestamps
$now = Carbon::now()->millisecond(0);
$duplicate->setCreatedAt($now);
$duplicate->setUpdatedAt($now);
$duplicate->setDeletedAt(null);
$this->entityManager->persist($duplicate);
$this->entityManager->flush();
return $duplicate;
}
}