Advertisement
Guest User

Untitled

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