Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.08 KB | None | 0 0
  1. <?php
  2.  
  3. namespace OCI\UserBundle\Entity;
  4.  
  5. use Symfony\Component\Security\Core\User\UserInterface;
  6. use Symfony\Component\Security\Core\User\AdvancedUserInterface;
  7.  
  8. /**
  9.  * @orm:Entity
  10.  * @orm:Entity(repositoryClass="OCI\UserBundle\Repository\UserRepository")
  11.  */
  12.  
  13.  
  14. class User implements AdvancedUserInterface
  15. {
  16.     /**
  17.      * @orm:ID
  18.      * @orm:Column(type="integer")
  19.      * @orm:GeneratedValue(strategy="AUTO")
  20.      */
  21.     protected $ID = null;
  22.  
  23.     /**
  24.      * @orm:Column(type="string", length="255", unique = true, nullable = false)
  25.      */
  26.     protected $username;
  27.    
  28.     /**
  29.      * @orm:Column(type="string", length="255", nullable = false)
  30.      */
  31.     protected $password;
  32.  
  33.     /**
  34.      * @orm:Column(type="string", length="255", nullable = true)
  35.      */
  36.     protected $token;
  37.    
  38.     /**
  39.      * @orm:Column(type="string", length="255", nullable = true)
  40.      */
  41.     protected $name;
  42.  
  43.     /**
  44.      * @orm:Column(type="string", length="255", nullable = false)
  45.      */
  46.     protected $lastname;
  47.    
  48.     /**
  49.      * @orm:Column(type="string", length="255", nullable = true)
  50.      */
  51.     protected $phone;
  52.    
  53.     /**
  54.      * @orm:Column(type="string", length="1", nullable = false)
  55.      * @orm:DefaultValue ("m")
  56.      */
  57.     protected $sex;
  58.    
  59.     /**
  60.      * @orm:Column(type="string", length="255", nullable = false)
  61.      */
  62.     protected $email;
  63.    
  64.     /**
  65.      * @orm:Column(type="string", length="255", nullable = true)
  66.      */
  67.     protected $department;
  68.    
  69.     /**
  70.      * @orm:Column(type="string", length="255", nullable = true)
  71.      */
  72.     protected $position;
  73.    
  74.     /**
  75.      * @orm:Column(type="string", length="255", nullable = false)
  76.      * @orm:DefaultValue ("ROLE_CLIENT")
  77.      */
  78.     protected $rights;
  79.    
  80.     /**
  81.      * @orm:Column(type="smallint", length="1", nullable = false)
  82.      * @orm:DefaultValue ("0")
  83.      */
  84.     protected $visitor;
  85.    
  86.     /**
  87.      * @orm:Column(type="smallint", length="1", nullable = false)
  88.      * @orm:DefaultValue ("0")
  89.      */
  90.     protected $loggedin;
  91.    
  92.     /**
  93.      * @orm:Column(type="smallint", length="1", nullable = false)
  94.      * @orm:DefaultValue ("1")
  95.      */
  96.     protected $active;
  97.    
  98.     /**
  99.      * @orm:Column(type="integer", nullable = true)
  100.      */
  101.     protected $lastlogin;
  102.    
  103.     /**
  104.      * @orm:Column(type="string", length="255", nullable = false)
  105.      */
  106.     protected $registerDate;
  107.    
  108.     /**
  109.      * @orm:oneToMany(targetEntity="Employee", mappedBy="user", cascade={"all"})
  110.      */
  111.     protected $companies;
  112.    
  113.     /**
  114.      * @orm:oneToMany(targetEntity="SystemInformation", mappedBy="user", cascade={"persist", "merge"})
  115.      */
  116.     protected $systemInformations;
  117.    
  118.     /**
  119.      * @orm:oneToMany(targetEntity="OCI\FileBundle\Entity\File", mappedBy="user", cascade={"persist", "merge"})
  120.      */
  121.     protected $upFiles;
  122.    
  123.     /**
  124.      * @orm:oneToMany(targetEntity="OCI\FileBundle\Entity\UserDownload", mappedBy="user", cascade={"all"})
  125.      */
  126.     protected $downFiles;
  127.    
  128.     /**
  129.      * @orm:oneToMany(targetEntity="OCI\FileBundle\Entity\UserFolderRights", mappedBy="user", cascade={"all"})
  130.      */
  131.     protected $folderRights;
  132.    
  133.     /**
  134.      * @orm:oneToMany(targetEntity="OCI\ProjectBundle\Entity\ProjectMember", mappedBy="user", cascade={"all"})
  135.      */
  136.     protected $projects;
  137.    
  138.     /**
  139.      * @orm:oneToMany(targetEntity="OCI\ProjectBundle\Entity\Note", mappedBy="user", cascade={"all"})
  140.      */
  141.     protected $notes;
  142.    
  143.     /**
  144.      * @orm:oneToMany(targetEntity="OCI\ProjectBundle\Entity\User2Appointment", mappedBy="user", cascade={"all"})
  145.      */
  146.     protected $appointments;
  147.     public function __construct()
  148.     {
  149.     $this->companies = new \Doctrine\Common\Collections\ArrayCollection();
  150.     $this->systemInformations = new \Doctrine\Common\Collections\ArrayCollection();
  151.     $this->upFiles = new \Doctrine\Common\Collections\ArrayCollection();
  152.     $this->downFiles = new \Doctrine\Common\Collections\ArrayCollection();
  153.     $this->folderRights = new \Doctrine\Common\Collections\ArrayCollection();
  154.     $this->projects = new \Doctrine\Common\Collections\ArrayCollection();
  155.     $this->notes = new \Doctrine\Common\Collections\ArrayCollection();
  156.     $this->appointments = new \Doctrine\Common\Collections\ArrayCollection();
  157.     }
  158.    
  159.     /**
  160.      * Get ID
  161.      *
  162.      * @return integer $iD
  163.      */
  164.     public function getID()
  165.     {
  166.         return $this->ID;
  167.     }
  168.  
  169.     /**
  170.      * Set username
  171.      *
  172.      * @param string $username
  173.      */
  174.     public function setUsername($username)
  175.     {
  176.         $this->username = $username;
  177.     }
  178.  
  179.     /**
  180.      * Get username
  181.      *
  182.      * @return string $username
  183.      */
  184.     public function getUsername()
  185.     {
  186.         return $this->email;
  187.     }
  188.  
  189.     /**
  190.      * Get uname
  191.      *
  192.      * @return string $username
  193.      */
  194.     public function getUname()
  195.     {
  196.         return $this->username;
  197.     }
  198.    
  199.     /**
  200.      * Set password
  201.      *
  202.      * @param string $password
  203.      */
  204.     public function setPassword($password)
  205.     {
  206.         $this->password = $password;
  207.     }
  208.  
  209.     /**
  210.      * Get password
  211.      *
  212.      * @return string $password
  213.      */
  214.     public function getPassword()
  215.     {
  216.         return $this->password;
  217.     }
  218.  
  219.     /**
  220.      * Set token
  221.      *
  222.      * @param string $token
  223.      */
  224.     public function setToken($token)
  225.     {
  226.         $this->token = $token;
  227.     }
  228.  
  229.     /**
  230.      * Get token
  231.      *
  232.      * @return string $token
  233.      */
  234.     public function getToken()
  235.     {
  236.         return $this->token;
  237.     }
  238.    
  239.    
  240.     /**
  241.      * Set name
  242.      *
  243.      * @param string $name
  244.      */
  245.     public function setName($name)
  246.     {
  247.         $this->name = $name;
  248.     }
  249.  
  250.     /**
  251.      * Get name
  252.      *
  253.      * @return string $name
  254.      */
  255.     public function getName()
  256.     {
  257.         return $this->name;
  258.     }
  259.  
  260.     /**
  261.      * Set lastname
  262.      *
  263.      * @param string $lastname
  264.      */
  265.     public function setLastname($lastname)
  266.     {
  267.         $this->lastname = $lastname;
  268.     }
  269.  
  270.     /**
  271.      * Get lastname
  272.      *
  273.      * @return string $lastname
  274.      */
  275.     public function getLastname()
  276.     {
  277.         return $this->lastname;
  278.     }
  279.  
  280.     /**
  281.      * Set phone
  282.      *
  283.      * @param string $phone
  284.      */
  285.     public function setPhone($phone)
  286.     {
  287.         $this->phone = $phone;
  288.     }
  289.  
  290.     /**
  291.      * Get phone
  292.      *
  293.      * @return string $phone
  294.      */
  295.     public function getPhone()
  296.     {
  297.         return $this->phone;
  298.     }
  299.  
  300.     /**
  301.      * Set sex
  302.      *
  303.      * @param string $sex
  304.      */
  305.     public function setSex($sex)
  306.     {
  307.         $this->sex = $sex;
  308.     }
  309.  
  310.     /**
  311.      * Get sex
  312.      *
  313.      * @return string $sex
  314.      */
  315.     public function getSex()
  316.     {
  317.         return $this->sex;
  318.     }
  319.  
  320.     /**
  321.      * Set email
  322.      *
  323.      * @param string $email
  324.      */
  325.     public function setEmail($email)
  326.     {
  327.         $this->email = $email;
  328.     }
  329.  
  330.     /**
  331.      * Get email
  332.      *
  333.      * @return string $email
  334.      */
  335.     public function getEmail()
  336.     {
  337.         return $this->email;
  338.     }
  339.  
  340.     /**
  341.      * Set department
  342.      *
  343.      * @param string $department
  344.      */
  345.     public function setDepartment($department)
  346.     {
  347.         $this->department = $department;
  348.     }
  349.  
  350.     /**
  351.      * Get department
  352.      *
  353.      * @return string $department
  354.      */
  355.     public function getDepartment()
  356.     {
  357.         return $this->department;
  358.     }
  359.  
  360.     /**
  361.      * Set position
  362.      *
  363.      * @param string $position
  364.      */
  365.     public function setPosition($position)
  366.     {
  367.         $this->position = $position;
  368.     }
  369.  
  370.     /**
  371.      * Get position
  372.      *
  373.      * @return string $position
  374.      */
  375.     public function getPosition()
  376.     {
  377.         return $this->position;
  378.     }
  379.  
  380.     /**
  381.      * Set rights
  382.      *
  383.      * @param string $rights
  384.      */
  385.     public function setRights($rights)
  386.     {
  387.         $this->rights = $rights;
  388.     }
  389.  
  390.     /**
  391.      * Get rights
  392.      *
  393.      * @return string $rights
  394.      */
  395.     public function getRights()
  396.     {
  397.         return $this->rights;
  398.     }
  399.  
  400.     /**
  401.      * Set visitor
  402.      *
  403.      * @param smallint $visitor
  404.      */
  405.     public function setVisitor($visitor)
  406.     {
  407.         $this->visitor = $visitor;
  408.     }
  409.  
  410.     /**
  411.      * Get visitor
  412.      *
  413.      * @return smallint $visitor
  414.      */
  415.     public function getVisitor()
  416.     {
  417.         return $this->visitor;
  418.     }
  419.  
  420.     /**
  421.      * Set loggedin
  422.      *
  423.      * @param smallint $loggedin
  424.      */
  425.     public function setLoggedin($loggedin)
  426.     {
  427.         $this->loggedin = $loggedin;
  428.     }
  429.  
  430.     /**
  431.      * Get loggedin
  432.      *
  433.      * @return smallint $loggedin
  434.      */
  435.     public function getLoggedin()
  436.     {
  437.         return $this->loggedin;
  438.     }
  439.  
  440.     /**
  441.      * Set active
  442.      *
  443.      * @param smallint $active
  444.      */
  445.     public function setActive($active)
  446.     {
  447.         $this->active = $active;
  448.     }
  449.  
  450.     /**
  451.      * Get active
  452.      *
  453.      * @return smallint $active
  454.      */
  455.     public function getActive()
  456.     {
  457.         return $this->active;
  458.     }
  459.  
  460.     /**
  461.      * Set lastlogin
  462.      *
  463.      * @param integer $lastlogin
  464.      */
  465.     public function setLastlogin($lastlogin)
  466.     {
  467.         $this->lastlogin = $lastlogin;
  468.     }
  469.  
  470.     /**
  471.      * Get lastlogin
  472.      *
  473.      * @return integer $lastlogin
  474.      */
  475.     public function getLastlogin()
  476.     {
  477.         return $this->lastlogin;
  478.     }
  479.  
  480.     /**
  481.      * Set registerDate
  482.      *
  483.      * @param string $registerDate
  484.      */
  485.     public function setRegisterDate($registerDate)
  486.     {
  487.         $this->registerDate = $registerDate;
  488.     }
  489.  
  490.     /**
  491.      * Get registerDate
  492.      *
  493.      * @return string $registerDate
  494.      */
  495.     public function getRegisterDate()
  496.     {
  497.         return $this->registerDate;
  498.     }
  499.  
  500.     /**
  501.      * Add companies
  502.      *
  503.      * @param OCI\UserBundle\Entity\Employee $companies
  504.      */
  505.     public function addCompanies(\OCI\UserBundle\Entity\Employee $companies)
  506.     {
  507.         $this->companies[] = $companies;
  508.     }
  509.  
  510.     /**
  511.      * Get companies
  512.      *
  513.      * @return Doctrine\Common\Collections\Collection $companies
  514.      */
  515.     public function getCompanies()
  516.     {
  517.         return $this->companies;
  518.     }
  519.  
  520.     /**
  521.      * Add systemInformations
  522.      *
  523.      * @param OCI\UserBundle\Entity\SystemInformation $systemInformations
  524.      */
  525.     public function addSystemInformations(\OCI\UserBundle\Entity\SystemInformation $systemInformations)
  526.     {
  527.         $this->systemInformations[] = $systemInformations;
  528.     }
  529.  
  530.     /**
  531.      * Get systemInformations
  532.      *
  533.      * @return Doctrine\Common\Collections\Collection $systemInformations
  534.      */
  535.     public function getSystemInformations()
  536.     {
  537.         return $this->systemInformations;
  538.     }
  539.  
  540.     /**
  541.      * Add upFiles
  542.      *
  543.      * @param OCI\FileBundle\Entity\File $upFiles
  544.      */
  545.     public function addUpFiles(\OCI\FileBundle\Entity\File $upFiles)
  546.     {
  547.         $this->upFiles[] = $upFiles;
  548.     }
  549.  
  550.     /**
  551.      * Get upFiles
  552.      *
  553.      * @return Doctrine\Common\Collections\Collection $upFiles
  554.      */
  555.     public function getUpFiles()
  556.     {
  557.         return $this->upFiles;
  558.     }
  559.  
  560.     /**
  561.      * Add downFiles
  562.      *
  563.      * @param OCI\FileBundle\Entity\UserDownload $downFiles
  564.      */
  565.     public function addDownFiles(\OCI\FileBundle\Entity\UserDownload $downFiles)
  566.     {
  567.         $this->downFiles[] = $downFiles;
  568.     }
  569.  
  570.     /**
  571.      * Get downFiles
  572.      *
  573.      * @return Doctrine\Common\Collections\Collection $downFiles
  574.      */
  575.     public function getDownFiles()
  576.     {
  577.         return $this->downFiles;
  578.     }
  579.  
  580.     /**
  581.      * Add folderRights
  582.      *
  583.      * @param OCI\FileBundle\Entity\UserFolderRights $folderRights
  584.      */
  585.     public function addFolderRights(\OCI\FileBundle\Entity\UserFolderRights $folderRights)
  586.     {
  587.         $this->folderRights[] = $folderRights;
  588.     }
  589.  
  590.     /**
  591.      * Get folderRights
  592.      *
  593.      * @return Doctrine\Common\Collections\Collection $folderRights
  594.      */
  595.     public function getFolderRights()
  596.     {
  597.         return $this->folderRights;
  598.     }
  599.  
  600.     /**
  601.      * Add projects
  602.      *
  603.      * @param OCI\ProjectBundle\Entity\ProjectMember $projects
  604.      */
  605.     public function addProjects(\OCI\ProjectBundle\Entity\ProjectMember $projects)
  606.     {
  607.         $this->projects[] = $projects;
  608.     }
  609.  
  610.     /**
  611.      * Get projects
  612.      *
  613.      * @return Doctrine\Common\Collections\Collection $projects
  614.      */
  615.     public function getProjects()
  616.     {
  617.         return $this->projects;
  618.     }
  619.  
  620.     /**
  621.      * Add notes
  622.      *
  623.      * @param OCI\ProjectBundle\Entity\Note $notes
  624.      */
  625.     public function addNotes(\OCI\ProjectBundle\Entity\Note $notes)
  626.     {
  627.         $this->notes[] = $notes;
  628.     }
  629.  
  630.     /**
  631.      * Get notes
  632.      *
  633.      * @return Doctrine\Common\Collections\Collection $notes
  634.      */
  635.     public function getNotes()
  636.     {
  637.         return $this->notes;
  638.     }
  639.  
  640.     /**
  641.      * Add appointments
  642.      *
  643.      * @param OCI\ProjectBundle\Entity\User2Appointment $appointments
  644.      */
  645.     public function addAppointments(\OCI\ProjectBundle\Entity\User2Appointment $appointments)
  646.     {
  647.         $this->appointments[] = $appointments;
  648.     }
  649.  
  650.     /**
  651.      * Get appointments
  652.      *
  653.      * @return Doctrine\Common\Collections\Collection $appointments
  654.      */
  655.     public function getAppointments()
  656.     {
  657.         return $this->appointments;
  658.     }
  659.    
  660.     /*
  661.      * ACCOUNT INTERFACE
  662.      */
  663.    
  664.     public function getSalt()
  665.     {
  666.         //return $this->getID();
  667.         return '';
  668.     }
  669.    
  670.     public function eraseCredentials()
  671.     {
  672.        
  673.     }
  674.    
  675.     public function getRoles()
  676.     {
  677.         return array($this->getRights());
  678.     }
  679.    
  680.     public function equals(UserInterface $username)
  681.     {
  682.         return true;
  683.     }
  684.  
  685.     public function isAccountNonExpired()
  686.     {
  687.         return true;
  688.     }
  689.    
  690.     public function isAccountNonLocked()
  691.     {
  692.         return true;
  693.     }
  694.    
  695.     public function isCredentialsNonExpired()
  696.     {
  697.         return true;
  698.     }
  699.    
  700.     public function isEnabled()
  701.     {
  702.         return $this->getActive();
  703.     }
  704. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement