/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $user = new Usuario(); $user->setUsername("admin"); $user->setNombre("Administrador"); $user->setSalt(md5(uniqid())); $encoder = $this->container->get('security.encoder_factory')->getEncoder($user); $user->setPassword($encoder->encodePassword('admin', $user->getSalt())); $manager->persist($user); $manager->flush(); }
/** * Displays a form to create a new Usuario entity. * * @Route("/new", name="usuarios_new") * @Method("GET") * @Template() */ public function newAction() { $entity = new Usuario(); $entity->setSalt(md5(rand() . rand() . rand())); $form = $this->createCreateForm($entity); return array('entity' => $entity, 'form' => $form->createView()); }