public function createUser($usuarioTO) { // Valida que el usuario no exista en la base de datos if ($this->existUser($usuarioTO->getUsername())) { throw new \Exception('No se pudo crear, el usuario ya existe en el sistema'); } $em = $this->getEntityManager(); // Crea los datos personales $datosPersonales = new Datospersonales(); $datosPersonales->setNombres($usuarioTO->getNombres()); $datosPersonales->setApellidos($usuarioTO->getApellidos()); $em->persist($datosPersonales); // Crea los datos ubicacion $datosUbicacion = new Datosubicacion(); $datosUbicacion->setDireccion($usuarioTO->getDireccion()); $datosUbicacion->setTelefono($usuarioTO->getTelefono()); $datosUbicacion->setCelular($usuarioTO->getCelular()); $datosUbicacion->setEmail($usuarioTO->getEmail()); $em->persist($datosUbicacion); // Crea al usuario $usuario = new Usuario(); $usuario->setUsername($usuarioTO->getUsername()); $usuario->setPassword(md5($usuarioTO->getPassword())); $usuario->setDatosPersonales($datosPersonales); $usuario->setDatosUbicacion($datosUbicacion); $usuario->setEstatus($em->getReference('VisitaYucatanBundle:Estatus', Estatuskeys::ESTATUS_ACTIVO)); $em->persist($usuario); $em->flush(); }
public function createDataLocation(VentaCompletaTO $ventaCompletaTO) { $dataLocation = new Datosubicacion(); $dataLocation->setLada($ventaCompletaTO->getLada()); $dataLocation->setTelefono($ventaCompletaTO->getTelefono()); $dataLocation->setEmail($ventaCompletaTO->getEmail()); $dataLocation->setCiudad($ventaCompletaTO->getCiudad()); return $dataLocation; }
public function createHotel($hotelTO) { $em = $this->getEntityManager(); $datosUbicacion = new Datosubicacion(); $datosUbicacion->setDireccion($hotelTO->getDireccion()); $datosUbicacion->setTelefono($hotelTO->getTelefono()); $em->persist($datosUbicacion); $hotel = new Hotel(); $hotel->setDescripcion($hotelTO->getDescripcion()); $hotel->setEstrellas($hotelTO->getEstrellas()); $hotel->setPromovido(Generalkeys::BOOLEAN_FALSE); $hotel->setDatosUbicacion($datosUbicacion); //$hotel->setDestino($em->getReference('VisitaYucatanBundle:Destino', $hotelTO->getIdDestino())); $hotel->setCiudad($em->getReference('VisitaYucatanBundle:Ciudad', $hotelTO->getCity())); $hotel->setEstatus($em->getReference('VisitaYucatanBundle:Estatus', Estatuskeys::ESTATUS_ACTIVO)); $hotel->setMapa($hotelTO->getMapa()); $em->persist($hotel); $em->flush(); }