diff --git a/.env b/.env index 764f2c0..7dc4420 100755 --- a/.env +++ b/.env @@ -24,7 +24,7 @@ APP_SECRET=db57d5b20b55689a1519cd62120fe723 # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Configure your db driver and server_version in config/packages/doctrine.yaml -DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db/database.sqlite +DATABASE_URL=pgsql://postgres:postgres@127.0.0.1:5432/vendas ###< doctrine/doctrine-bundle ### ###> symfony/swiftmailer-bundle ### diff --git a/src/Controller/ImovelController.php b/src/Controller/ImovelController.php new file mode 100644 index 0000000..dfcc38e --- /dev/null +++ b/src/Controller/ImovelController.php @@ -0,0 +1,30 @@ +setStatus("alugado"); + $imovel->setEnderecoId(); + + $em = $this->getDoctrine()->getManager(); + $em->persist($imovel); + $em->flush(); + } +} \ No newline at end of file diff --git a/src/Controller/UsuarioController.php b/src/Controller/UsuarioController.php new file mode 100644 index 0000000..00933d3 --- /dev/null +++ b/src/Controller/UsuarioController.php @@ -0,0 +1,36 @@ +createForm(UsuarioType::class, $usuario); + $form->handleRequest($request); + + $usuarioService = $this->get(UsuarioService::class); + + if($form->isSubmitted()) { + $usuario = $form->getData(); + + } + } + +} \ No newline at end of file diff --git a/src/Entity/Endereco.php b/src/Entity/Endereco.php index a7ce442..cb40419 100644 --- a/src/Entity/Endereco.php +++ b/src/Entity/Endereco.php @@ -1,5 +1,9 @@ cliente; + return $this->usuario; } /** - * @param mixed $cliente + * @param mixed $usuario */ - public function setCliente($cliente): void + public function setUsuario($usuario): void { - $this->cliente = $cliente; + $this->usuario = $usuario; } /** diff --git a/src/Entity/Usuario.php b/src/Entity/Usuario.php index 67a8780..2de1efe 100644 --- a/src/Entity/Usuario.php +++ b/src/Entity/Usuario.php @@ -1,9 +1,12 @@ id; + } + + /** + * @return mixed + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param mixed $status + */ + public function setStatus($status): void + { + $this->status = $status; + } + + /** + * @return mixed + */ + public function getCaracteristicas() + { + return $this->caracteristicas; + } + + /** + * @param mixed $caracteristicas + */ + public function setCaracteristicas($caracteristicas): void + { + $this->caracteristicas = $caracteristicas; + } + + /** + * @return mixed + */ + public function getObservacao() + { + return $this->observacao; + } + + /** + * @param mixed $observacao + */ + public function setObservacao($observacao): void + { + $this->observacao = $observacao; + } + + /** + * @return mixed + */ + public function getDtCadastro() + { + return $this->dt_cadastro; + } + + /** + * @param mixed $dt_cadastro + */ + public function setDtCadastro($dt_cadastro): void + { + $this->dt_cadastro = $dt_cadastro; + } + + /** + * @return mixed + */ + public function getEnderecoId() + { + return $this->endereco_id; + } + + /** + * @param mixed $endereco_id + */ + public function setEnderecoId($endereco_id): void + { + $this->endereco_id = $endereco_id; + } +} \ No newline at end of file diff --git a/src/Forms/EnderecoType.php b/src/Forms/EnderecoType.php new file mode 100644 index 0000000..70306ab --- /dev/null +++ b/src/Forms/EnderecoType.php @@ -0,0 +1,78 @@ +setAction('../endereco') +// ->setMethod('POST') + ->add('logradouro', TextType::class, [ + 'label' => 'Logradouro', + ]) + ->add('bairro', TextType::class, [ + 'label' => 'Bairro', + ]) + ->add('numero', TextType::class, [ + 'label' => 'Numero', + ]) + ->add('cep', TextType::class, [ + 'label' => 'CEP', + 'attr' => [ + 'style' => 'width: 200px' + ] + ]) + ->add('complemento', TextType::class, [ + 'label' => 'Complemento', + ]) + ->add('cidade', TextType::class, [ + 'label' => 'Cidade', + ]) + ->add('uf', TextType::class, [ + 'label' => 'UF', + ]) + ->add('telefone', TextType::class, [ + 'label' => 'telefone', + ]) + ->add('ddd', TextType::class, [ + 'label' => 'DDD', + ]) + ->add('celular', TextType::class, [ + 'label' => 'Celular', + ]) + ->add('dddCelular', TextType::class, [ + 'label' => 'DDD', + ]) + ->add('usuario', UsuarioType::class) + ; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Endereco::class, + ]); + } +} diff --git a/src/Forms/UsuarioType.php b/src/Forms/UsuarioType.php new file mode 100644 index 0000000..198f781 --- /dev/null +++ b/src/Forms/UsuarioType.php @@ -0,0 +1,72 @@ +setAction('../usuario') +// ->setMethod('POST') + ->add('nome', TextType::class, [ + 'label' => 'Nome', + ]) + ->add('cpfCnpj', TextType::class, [ + 'label' => 'Cpf', + 'attr' => [ + 'style' => 'width: 200px', + 'data-mask' => '000.000.000-00', + 'placeholder' => '_ _ _ . _ _ _ . _ _ _ - _ _' + ] + ]) + ->add('sexo', TextType::class, [ + 'label' => 'Sexo', + ]) + ->add('email', EmailType::class, [ + 'label' => 'Email', + ]) + ->add('dtNascimento', DateType::class, [ + 'label' => 'Data de Nascimento', + 'widget' => 'single_text', + 'attr' => ['class' => 'js-datepicker'], + ]) + ->add('dtCadastro', DateType::class, [ + 'label' => 'Data de Cadastro', + 'widget' => 'single_text', + 'attr' => ['class' => 'js-datepicker'], + ]) + ->add('tipoUsuario', TextType::class, [ + 'label' => 'Tipo De usuário', + ]) + ->add('endereco', EnderecoType::class) + ; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Usuario::class, + ]); + } +} diff --git a/src/Repository/UsuarioRepository.php b/src/Repository/UsuarioRepository.php new file mode 100644 index 0000000..b5df1c5 --- /dev/null +++ b/src/Repository/UsuarioRepository.php @@ -0,0 +1,27 @@ +getEntityManager(); + $em->persist($usuario); + $em->flush(); + } +} \ No newline at end of file diff --git a/src/Service/UsuarioService.php b/src/Service/UsuarioService.php new file mode 100644 index 0000000..f7b96e4 --- /dev/null +++ b/src/Service/UsuarioService.php @@ -0,0 +1,28 @@ +usuarioRepository = $usuarioRepository; + } + + public function salvar(Usuario $usuario) + { + $this->usuarioRepository->salvar($usuario); + } +} \ No newline at end of file