/** * @param User $user * * @throws PersisterException * @throws \Exception */ public function createUser(User $user) { $user->setUsername($user->getEmail()); try { $transaction = new Transaction(); $transaction->setAmount(0); $transaction->setDate(new \DateTime(date("Y-m-d H:i:s"))); $transaction->setOperation('Ouverture du compte'); $transaction->setTotalMoney(0); $user->addTransaction($transaction); $this->userDao->persist($user); } catch (PersisterException $e) { throw $e; } }