Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace UCPG\Entity;
- /**
- * @Entity(repositoryClass="UCPG\Entity\Repository\AccountRepository")
- * @Table(name="account",indexes={@index(name="username_UNIQUE",columns={"username"}),@index(name="fk_account_user",columns={"user_id"})})
- */
- class Account
- {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @OneToOne(targetEntity="User", inversedBy="Account")
- * @JoinColumn(name="user_id", referencedColumnName="id")
- */
- private $user;
- /**
- * @Column(type="string",length=10)
- */
- private $username;
- /**
- * @Column(type="string",length=32)
- */
- private $password;
- /**
- * @Column(type="string",length=10)
- */
- private $role;
- public function __construct()
- {
- }
- public function setId($id)
- {
- $this->id = $id;
- return $this; // fluent interface
- }
- public function getId()
- {
- return $this->id;
- }
- public function setUser(User $user)
- {
- $user->addAccount($this);
- $this->user = $user;
- return $this; // fluent interface
- }
- public function getUser()
- {
- return $this->user;
- }
- public function setUsername($username)
- {
- $this->username = $username;
- return $this; // fluent interface
- }
- public function getUsername()
- {
- return $this->username;
- }
- public function setPassword($password)
- {
- $this->password = $password;
- return $this; // fluent interface
- }
- public function getPassword()
- {
- return $this->password;
- }
- public function setRole($role)
- {
- $this->role = $role;
- return $this; // fluent interface
- }
- public function getRole()
- {
- return $this->role;
- }
- }
- // ----------------------------------------------------------------------------------------
- <?php
- namespace UCPG\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- /**
- * @Entity(repositoryClass="UCPG\Entity\Repository\UserRepository")
- * @Table(name="user",indexes={@index(name="fk_user_praktijk1",columns={"praktijk_id"})})
- */
- class User
- {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @OneToOne(targetEntity="Account", mappedBy="User")
- */
- private $account;
- /**
- * @OneToMany(targetEntity="Instance", mappedBy="User")
- */
- private $instances;
- /**
- * @ManyToOne(targetEntity="Praktijk", inversedBy="User")
- */
- private $praktijk;
- /**
- * @Column(type="string",length=60)
- */
- private $firstname;
- /**
- * @Column(type="string",length=60,nullable=true)
- */
- private $middlename;
- /**
- * @Column(type="string",length=60)
- */
- private $lastname;
- /**
- * @Column(type="datetime",nullable=true)
- */
- private $dob;
- /**
- * @Column(type="boolean")
- */
- private $gender;
- /**
- * @Column(type="datetime",nullable=true)
- */
- private $created;
- /**
- * @Column(type="datetime")
- */
- private $modified;
- public function __construct()
- {
- }
- public function setId($id)
- {
- $this->id = $id;
- return $this; // fluent interface
- }
- public function getId()
- {
- return $this->id;
- }
- public function addAccount(Account $account)
- {
- $this->account = $account;
- return $this; // fluent interface
- }
- public function getAccount()
- {
- return $this->account;
- }
- public function addInstance(Instance $instance)
- {
- $this->instances[] = $instance;
- return $this; // fluent interface
- }
- public function getInstances()
- {
- return $this->instances;
- }
- public function setPraktijk(Praktijk $praktijk)
- {
- $praktijk->addUser($this);
- $this->praktijk = $praktijk;
- return $this; // fluent interface
- }
- public function getPraktijk()
- {
- return $this->praktijk;
- }
- public function setFirstname($firstname)
- {
- $this->firstname = $firstname;
- return $this; // fluent interface
- }
- public function getFirstname()
- {
- return $this->firstname;
- }
- public function setMiddlename($middlename)
- {
- $this->middlename = $middlename;
- return $this; // fluent interface
- }
- public function getMiddlename()
- {
- return $this->middlename;
- }
- public function setLastname($lastname)
- {
- $this->lastname = $lastname;
- return $this; // fluent interface
- }
- public function getLastname()
- {
- return $this->lastname;
- }
- public function setDob($dob)
- {
- $this->dob = $dob;
- return $this; // fluent interface
- }
- public function getDob()
- {
- return $this->dob;
- }
- public function setGender($gender)
- {
- $this->gender = $gender;
- return $this; // fluent interface
- }
- public function getGender()
- {
- return $this->gender;
- }
- public function setCreated($created)
- {
- $this->created = $created;
- return $this; // fluent interface
- }
- public function getCreated()
- {
- return $this->created;
- }
- public function setModified($modified)
- {
- $this->modified = $modified;
- return $this; // fluent interface
- }
- public function getModified()
- {
- return $this->modified;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement