/** * 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 getId() { if ($this->__isInitialized__ === false) { return (int) parent::getId(); } $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array()); return parent::getId(); }
/** * Displays a form to edit an existing Usuario entity. * * @param Usuario $user * * @return \Symfony\Component\HttpFoundation\Response * * @Route("/{id}/edit", name="security_usuario_edit") */ public function editAction(Usuario $user) { $editForm = $this->createEditForm(new UserModel($user)); $deleteForm = $this->createDeleteForm($user->getId()); return $this->render('HatueySoftSecurityBundle:Usuario:edit.html.twig', array('entity' => $user, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView())); }