dongyi6668 2016-09-29 11:30
浏览 24

在Symfony表单后将Doctorine对象重置为原始值

I have a Symfony form where my customers can downgrade their account. Only when downgrading a account there is an delay (one full month) before the changes are effective. With an upgrade the changes are right a way effective.

After the validation of the account form i check if it is an downgrade op upgrade. With an upgrade i just flush the changed in the account so they are stored.

            $em = $this->getDoctrine()->getManager();
            $em->flush();

But when it is an downgrade i want to reset the object to its original values, so before the form changes. Then I add an value in the downgrade field of the later change.

I tried to unset the $account and then load it again. But I get the field values that are changed in the form. Is there a way to reset it?

                unset($account);

            $account = $this->getDoctrine()
                ->getRepository('MyBundle:Account')
                ->findOneBy(
                    array('id' => $this->get('session')->get('AccountId'))
                );
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?