Advertisement
Guest User

Untitled

a guest
Aug 15th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.55 KB | None | 0 0
  1. <?php
  2.  
  3. namespace SeguridadBundle\Entity;
  4.  
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use FOS\UserBundle\Model\User as BaseUser;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * User
  11.  *
  12.  * @ORM\Entity
  13.  * @ORM\Table(name="fos_user")
  14.  */
  15. class User extends BaseUser
  16. {
  17.  
  18.     public function __toString()
  19.     {
  20.         return $this->getEmail();
  21.     }
  22.  
  23.     public function __construct()
  24.     {
  25.         parent::__construct();
  26.  
  27.         $this->observaciones = new ArrayCollection();
  28.     }
  29.  
  30.  
  31.     /**
  32.      * @ORM\Id
  33.      * @ORM\Column(type="integer")
  34.      * @ORM\GeneratedValue(strategy="AUTO")
  35.      */
  36.     protected $id;
  37.  
  38.     /**
  39.      * GRUPOS
  40.      * @ORM\OneToMany(targetEntity="SeguridadBundle\Entity\UserGroup", mappedBy="cuenta", cascade={"persist", "remove"})
  41.      */
  42.     private $grupos;
  43.  
  44.  
  45.     /**
  46.      * @ORM\OneToMany(targetEntity="DeteccionBundle\Entity\ObservacionEquipo", mappedBy="usuario", cascade={"persist", "remove"})
  47.      */
  48.     private $observaciones;
  49.  
  50.  
  51.     // RELACION CPU -- PANTALLAS ////////
  52.     //////////////////////////////////
  53.     public function setObservaciones(\Doctrine\Common\Collections\Collection $observaciones)
  54.     {
  55.         $this->observaciones = $observaciones;
  56.         foreach ($observaciones as $obser) {
  57.             $obser->setUsuario($this);
  58.         }
  59.     }
  60.  
  61.  
  62.  
  63.     /**
  64.      * Add grupo
  65.      *
  66.      * @param \SeguridadBundle\Entity\UserGroup $grupo
  67.      *
  68.      * @return User
  69.      */
  70.     public function addGrupo(\SeguridadBundle\Entity\UserGroup $grupo)
  71.     {
  72.         $this->grupos[] = $grupo;
  73.  
  74.         return $this;
  75.     }
  76.  
  77.     /**
  78.      * Remove grupo
  79.      *
  80.      * @param \SeguridadBundle\Entity\UserGroup $grupo
  81.      */
  82.     public function removeGrupo(\SeguridadBundle\Entity\UserGroup $grupo)
  83.     {
  84.         $this->grupos->removeElement($grupo);
  85.     }
  86.  
  87.     /**
  88.      * Get grupos
  89.      *
  90.      * @return \Doctrine\Common\Collections\Collection
  91.      */
  92.     public function getGrupos()
  93.     {
  94.         return $this->grupos;
  95.     }
  96.  
  97.    
  98.     /**
  99.      * Remove observacione
  100.      *
  101.      * @param \DeteccionBundle\Entity\ObservacionEquipo $observacione
  102.      */
  103.     public function removeObservacione(\DeteccionBundle\Entity\ObservacionEquipo $observacione)
  104.     {
  105.         $this->observaciones->removeElement($observacione);
  106.     }
  107.  
  108.     /**
  109.      * Get observaciones
  110.      *
  111.      * @return \Doctrine\Common\Collections\Collection
  112.      */
  113.     public function getObservaciones()
  114.     {
  115.         return $this->observaciones;
  116.     }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement