예제 #1
0
 /**
  * UserModel constructor.
  *
  * @param User $user
  */
 public function __construct(User $user = null)
 {
     if ($user !== null) {
         $this->id = $user->getId();
         $this->username = $user->getUsername();
         $this->email = $user->getEmail();
         $this->nombres = $user->getNombres();
         $this->apellidos = $user->getApellidos();
         if (count($user->getRoles()) > 0) {
             $this->roles = array();
             foreach ($user->getRoles() as $role) {
                 $this->roles[] = $role;
             }
         }
         if (count($user->getGroups()) > 0) {
             $this->groups = new ArrayCollection();
             foreach ($user->getGroups() as $group) {
                 $this->groups->add($group);
             }
         }
         if (count($user->getProyectos()) > 0) {
             $this->proyectos = new ArrayCollection();
             foreach ($user->getProyectos() as $proyecto) {
                 $this->proyectos->add($proyecto);
             }
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getApellidos()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getApellidos', array());
     return parent::getApellidos();
 }