Skip to content

Instantly share code, notes, and snippets.

@ppeiris
Last active December 27, 2015 09:39
Show Gist options
  • Save ppeiris/7304906 to your computer and use it in GitHub Desktop.
Save ppeiris/7304906 to your computer and use it in GitHub Desktop.
<?php
namespace Entity\Tables;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
*/
class tAccounts {
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $accountId;
/**
* @ORM\OneToMany(targetEntity="tAccountPasswordReset", mappedBy="account", cascade={"all"})
*/
private $accountPassReset;
public function __construct() {
/** Get the dependence rowset from the tAccountPasswordReset */
$this->accountPassReset = new ArrayCollection;
}
/** using magic methods for setters and getters */
public function __get($name) {
return $this->{$name};
}
public function __set($name, $val) {
$this->{$name} = $val;
}
/**
* Add a account reset token.
* @param tAccountPasswordReset Entity
*
*/
public function addReset(tAccountPasswordReset $reset)
{
$reset->accountId = $this->accountId;
$this->accountPassReset->add($reset);
$reset->setAccount($this);
}
public function removePasswordReset(tAccountPasswordReset $reset)
{
$this->accountPassReset->removeElement($reset);
$reset->setAccount(null);
}
public function getPasswordResets()
{
return $this->accountPassReset;
}
/**
* This assing the resetToken when user request to reset the password.
*/
public function setPasswordResetToken($token) {
$this->accountResetToken = $token;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment