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'))
);