Skip to content

Instantly share code, notes, and snippets.

@ppeiris
Last active December 27, 2015 09:59
Show Gist options
  • Save ppeiris/7307713 to your computer and use it in GitHub Desktop.
Save ppeiris/7307713 to your computer and use it in GitHub Desktop.
<?php
$account = $this->entityManager->getRepository('\Entity\Tables\tAccounts');
/** Find the account from tAccounts table */
$record = $account->findOneBy(array('userEmail' => $email));
if ($record) { // There is an active account for given email.
/** Generate a unique token */
$token = uniqid().uniqid();
/** create a new tAccountPasswordReset object and fill the info */
$newReset = new \Entity\Tables\tAccountPasswordReset();
$newReset->resetToken = $token;
/**
* addReset() is define the the tAccounts Entity
*/
$record->addReset($newReset);
$this->entityManager->flush();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment