Manager/FormManager.php
public function save($data, $locale = null, $id = null)
    {
        $form = new Form();

        // Find exist or create new entity.
        if ($id) {
            $form = $this->findById($id, $locale);

            if (!$form) {
                return null;
            }
        }

        // Translation
        $translation = $form->getTranslation($locale, true);
        $translation->setTitle(self::getValue($data, 'title'));
        $translation->setSubject(self::getValue($data, 'subject'));
        $translation->setFromEmail(self::getValue($data, 'fromEmail'));
        $translation->setFromName(self::getValue($data, 'fromName'));
        $translation->setToEmail(self::getValue($data, 'toEmail'));
        $translation->setToName(self::getValue($data, 'toName'));
        $translation->setMailText(self::getValue($data, 'mailText'));
        $translation->setSubmitLabel(self::getValue($data, 'submitLabel'));
        $translation->setSuccessText(self::getValue($data, 'successText'));
        $translation->setSendAttachments(self::getValue($data, 'sendAttachments', false));
        $translation->setDeactivateNotifyMails(self::getValue($data, 'deactivateNotifyMails', false));
        $translation->setDeactivateCustomerMails(self::getValue($data, 'deactivateCustomerMails', false));
        $translation->setReplyTo(self::getValue($data, 'replyTo', false));
        $translation->setChanged(new \DateTime());

        // Add Translation to Form.
        if (!$translation->getId()) {
            $translation->setForm($form);
            $form->addTranslation($translation);
        }

        // Set Default Locale.
        if (!$form->getId()) {
            $form->setDefaultLocale($locale);
        }

        // Update field of form and the receivers.
        $this->updateFields($data, $form, $locale);
        $this->updateReceivers($data, $translation);

        $this->entityManager->persist($form);
        $this->entityManager->flush();

        if (!$id) {
            // To avoid lazy load of sub entities in the serializer reload whole object with sub entities from db
            // remove this when you don`t join anything in `findById`.
            $form = $this->findById($form->getId(), $locale);
        }

        return $form;
    }
public function save($data, $locale = null, $id = null)
    {
        $form = new Form();

        // Find exist or create new entity.
        if ($id) {
            $form = $this->findById($id, $locale);

            if (!$form) {
                return null;
            }
        }

        // Translation
        $translation = $form->getTranslation($locale, true);
        $translation->setTitle(self::getValue($data, 'title'));
        $translation->setSubject(self::getValue($data, 'subject'));
        $translation->setFromEmail(self::getValue($data, 'fromEmail'));
        $translation->setFromName(self::getValue($data, 'fromName'));
        $translation->setToEmail(self::getValue($data, 'toEmail'));
        $translation->setToName(self::getValue($data, 'toName'));
        $translation->setMailText(self::getValue($data, 'mailText'));
        $translation->setSubmitLabel(self::getValue($data, 'submitLabel'));
        $translation->setSuccessText(self::getValue($data, 'successText'));
        $translation->setSendAttachments(self::getValue($data, 'sendAttachments', false));
        $translation->setDeactivateNotifyMails(self::getValue($data, 'deactivateNotifyMails', false));
        $translation->setDeactivateCustomerMails(self::getValue($data, 'deactivateCustomerMails', false));
        $translation->setReplyTo(self::getValue($data, 'replyTo', false));
        $translation->setChanged(new \DateTime());

        // Add Translation to Form.
        if (!$translation->getId()) {
            $translation->setForm($form);
            $form->addTranslation($translation);
        }

        // Set Default Locale.
        if (!$form->getId()) {
            $form->setDefaultLocale($locale);
        }

        // Update field of form and the receivers.
        $this->updateFields($data, $form, $locale);
        $this->updateReceivers($data, $translation);

        $this->entityManager->persist($form);
        $this->entityManager->flush();

        if (!$id) {
            // To avoid lazy load of sub entities in the serializer reload whole object with sub entities from db
            // remove this when you don`t join anything in `findById`.
            $form = $this->findById($form->getId(), $locale);
        }

        return $form;
    }
@param array $data
@param string $locale
@param int $id

@return Form|null