Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Symfony\Component\Validator\Constraints\DateTime;
- /**
- * @ORM\Entity
- * @ORM\Table(name="owners")
- * @ORM\HasLifecycleCallbacks
- */
- class Owner implements UserInterface, \Serializable
- {
- /**
- * @ORM\Column(type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=100, nullable=true)
- */
- private $name;
- /**
- * @ORM\Column(type="datetime", nullable=true)
- */
- private $birthdate;
- /**
- * @ORM\Column(type="datetime", nullable=true)
- */
- private $last_login;
- /**
- * @ORM\Column(type="datetime", nullable=true)
- */
- private $registration;
- /**
- * @ORM\Column(type="string", length=150, nullable=true)
- */
- private $email;
- /**
- * @ORM\Column(type="string", length=150, nullable=true)
- */
- private $password;
- private $passwordConfirm;
- /**
- * @ORM\OneToMany(targetEntity="Car", mappedBy="owner")
- */
- private $owned_cars;
- /**
- * @ORM\PreUpdate
- */
- public function updateLastLoginTimeStamp()
- {
- $this->last_login = new \DateTime(date("Y-m-d H:i:s"));
- }
- /**
- * @ORM\PrePersist
- */
- public function updateRegTimeStamp()
- {
- if($this->registration == null)
- $this->registration = new \DateTime(date("Y-m-d H:i:s"));
- }
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->owned_cars = new \Doctrine\Common\Collections\ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set name
- *
- * @param string $name
- *
- * @return Owner
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set birthdate
- *
- * @param \DateTime $birthdate
- *
- * @return Owner
- */
- public function setBirthdate($birthdate)
- {
- $this->birthdate = $birthdate;
- return $this;
- }
- /**
- * Get birthdate
- *
- * @return \DateTime
- */
- public function getBirthdate()
- {
- return $this->birthdate;
- }
- /**
- * Set lastLogin
- *
- * @param \DateTime $lastLogin
- *
- * @return Owner
- */
- public function setLastLogin($lastLogin)
- {
- $this->last_login = $lastLogin;
- return $this;
- }
- /**
- * Get lastLogin
- *
- * @return \DateTime
- */
- public function getLastLogin()
- {
- return $this->last_login;
- }
- /**
- * Set registration
- *
- * @param \DateTime $registration
- *
- * @return Owner
- */
- public function setRegistration($registration)
- {
- $this->registration = $registration;
- return $this;
- }
- /**
- * Get registration
- *
- * @return \DateTime
- */
- public function getRegistration()
- {
- return $this->registration;
- }
- /**
- * Set email
- *
- * @param string $email
- *
- * @return Owner
- */
- public function setEmail($email)
- {
- $this->email = $email;
- return $this;
- }
- /**
- * Get email
- *
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * Set password
- *
- * @param string $password
- *
- * @return Owner
- */
- public function setPassword($password)
- {
- $this->password = $password;//password_hash($password, PASSWORD_BCRYPT);
- return $this;
- }
- /**
- * Get password
- *
- * @return string
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * Set passwordConfirm
- *
- * @param string $password
- *
- * @return Owner
- */
- public function setPasswordConfirm($passwordConfirm)
- {
- $this->$passwordConfirm = $passwordConfirm;
- return $this;
- }
- /**
- * Get passwordConfirm
- *
- * @return string
- */
- public function getPasswordConfirm()
- {
- return $this->passwordConfirm;
- }
- /**
- * Add ownedCar
- *
- * @param \AppBundle\Entity\Car $ownedCar
- *
- * @return Owner
- */
- public function addOwnedCar(\AppBundle\Entity\Car $ownedCar)
- {
- $this->owned_cars[] = $ownedCar;
- return $this;
- }
- /**
- * Remove ownedCar
- *
- * @param \AppBundle\Entity\Car $ownedCar
- */
- public function removeOwnedCar(\AppBundle\Entity\Car $ownedCar)
- {
- $this->owned_cars->removeElement($ownedCar);
- }
- /**
- * Get ownedCars
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getOwnedCars()
- {
- return $this->owned_cars;
- }
- public function getRoles()
- {
- return array('ROLE_USER');
- }
- public function eraseCredentials()
- {
- }
- /** @see \Serializable::serialize() */
- public function serialize()
- {
- return serialize(array(
- $this->id,
- $this->name,
- $this->password,
- // see section on salt below
- // $this->salt,
- ));
- }
- /** @see \Serializable::unserialize() */
- public function unserialize($serialized)
- {
- list (
- $this->id,
- $this->name,
- $this->password,
- // see section on salt below
- // $this->salt
- ) = unserialize($serialized);
- }
- /**
- * Returns the salt that was originally used to encode the password.
- *
- * This can return null if the password was not encoded using a salt.
- *
- * @return string|null The salt
- */
- public function getSalt()
- {
- // TODO: Implement getSalt() method.
- }
- /**
- * Returns the username used to authenticate the user.
- *
- * @return string The username
- */
- public function getUsername()
- {
- // TODO: Implement getUsername() method.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement