diff --git a/data/database.sqlite b/data/database.sqlite index 6804099..aade635 100755 Binary files a/data/database.sqlite and b/data/database.sqlite differ diff --git a/src/Controller/ImovelController.php b/src/Controller/ImovelController.php index 5cbf296..52db094 100644 --- a/src/Controller/ImovelController.php +++ b/src/Controller/ImovelController.php @@ -54,6 +54,19 @@ public function listarImoveis() ]); } + /** + * @Route("/deletar/{id}", name="deletar_imovel") + */ + public function deletarImovel(int $id, Request $request) + { + $em = $this->getDoctrine()->getManager(); + $imovel = $em->getRepository(Imovel::class)->find($id); + $em->remove($imovel); + $em->flush(); + $this->addFlash('success', 'Imovel de id:'.$id.' removido com sucesso!'); + return $this->redirectToRoute('listar_imoveis'); + } + /** * @Route("/imovel/portifolios", name="listar_portifolios") */ diff --git a/src/Entity/ContratoAdm.php b/src/Entity/ContratoAdm.php new file mode 100644 index 0000000..228e2a2 --- /dev/null +++ b/src/Entity/ContratoAdm.php @@ -0,0 +1,111 @@ +id; + } + /** + * @param mixed $id + */ + public function setId($id): void + { + $this->id = $id; + } + /** + * @return mixed + */ + public function getDtCadastro() + { + return $this->dtCadastro; + } + /** + * @param mixed $dtCadastro + */ + public function setDtCadastro($dtCadastro): void + { + $this->dtCadastro = $dtCadastro; + } + /** + * @return mixed + */ + public function getUsuario() + { + return $this->usuario; + } + /** + * @param mixed $usuario + */ + public function setUsuario($usuario): void + { + $this->usuario = $usuario; + } + /** + * @return mixed + */ + public function getImovel() + { + return $this->imovel; + } + /** + * @param mixed $imovel + */ + public function setImovel($imovel): void + { + $this->imovel = $imovel; + } + /** + * @return mixed + */ + /** + * @return mixed + */ + public function getClausulaContratual() + { + return $this->clausulaContratual; + } + /** + * @param mixed $clausula_contratual + */ + public function setClausulaContratual($clausula_contratual): void + { + $this->clausula_contratual = $clausula_contratual; + } + +} \ No newline at end of file diff --git a/src/Entity/ContratoLocacao.php b/src/Entity/ContratoLocacao.php new file mode 100644 index 0000000..378eee6 --- /dev/null +++ b/src/Entity/ContratoLocacao.php @@ -0,0 +1,163 @@ +id; + } + /** + * @param mixed $id + */ + public function setId($id): void + { + $this->id = $id; + } + /** + * @return mixed + */ + public function getDtCadastro() + { + return $this->dtCadastro; + } + /** + * @param mixed $dtCadastro + */ + public function setDtCadastro($dtCadastro): void + { + $this->dtCadastro = $dtCadastro; + } + /** + * @return mixed + */ + public function getDtValidade() + { + return $this->dtValidade; + } + /** + * @param mixed $dtValidade + */ + public function setDtValidade($dtValidade): void + { + $this->dtValidade = $dtValidade; + } + /** + * @return mixed + */ + public function getFormaPagamento() + { + return $this->formaPagamento; + } + /** + * @param mixed $formaPagamento + */ + public function setFormaPagamento($formaPagamento): void + { + $this->formaPagamento = $formaPagamento; + } + /** + * @return mixed + */ + public function getDtVencimento() + { + return $this->dtVencimento; + } + /** + * @param mixed $dtVencimento + */ + public function setDtVencimento($dtVencimento): void + { + $this->dtVencimento = $dtVencimento; + } + /** + * @return mixed + */ + public function getUsuario() + { + return $this->usuario; + } + /** + * @param mixed $usuario + */ + public function setUsuario($usuario): void + { + $this->usuario = $usuario; + } + /** + * @return mixed + */ + public function getImovel() + { + return $this->imovel; + } + /** + * @param mixed $imovel + */ + public function setImovel($imovel): void + { + $this->imovel = $imovel; + } + /** + * @return mixed + */ + public function getClausulaContratual() + { + return $this->clausulaContratual; + } + /** + * @param mixed $clausulaContratual + */ + public function setClausulaContratual($clausulaContratual): void + { + $this->clausulaContratual = $clausulaContratual; + } + +} \ No newline at end of file diff --git a/src/Entity/Imovel.php b/src/Entity/Imovel.php index e50f78c..59c4ca8 100644 --- a/src/Entity/Imovel.php +++ b/src/Entity/Imovel.php @@ -47,7 +47,15 @@ class Imovel */ private $endereco; + /** + * @ORM\OneToMany(targetEntity="App\Entity\ContratoLocacao", mappedBy="imovel") + */ + private $contratoLocacao; + /** + * @ORM\OneToMany(targetEntity="App\Entity\ContratoAdm", mappedBy="imovel") + */ + private $contratoAdm; /** * @return mixed @@ -161,13 +169,37 @@ public function setEndereco($endereco): void $this->endereco = $endereco; } -// /** -// * @ORM\OneToMany(targetEntity="Entity\contratoLocacao", mappedBy="imovel") -// */ -// private $contratoLocacao; -// -// /** -// * @ORM\OneToMany(targetEntity="Entity\ContratoAdm", mappedBy="imovel") -// */ -// private $contratoAdm; + /** + * @return mixed + */ + public function getContratoLocacao() + { + return $this->contratoLocacao; + } + + /** + * @param mixed $contratoLocacao + */ + public function setContratoLocacao($contratoLocacao): void + { + $this->contratoLocacao = $contratoLocacao; + } + + /** + * @return mixed + */ + public function getContratoAdm() + { + return $this->contratoAdm; + } + + /** + * @param mixed $contratoAdm + */ + public function setContratoAdm($contratoAdm): void + { + $this->contratoAdm = $contratoAdm; + } + + } \ No newline at end of file diff --git a/src/Repository/ImovelRepository.php b/src/Repository/ImovelRepository.php new file mode 100644 index 0000000..d29f980 --- /dev/null +++ b/src/Repository/ImovelRepository.php @@ -0,0 +1,28 @@ +getEntityManager(); + $em->persist($imovel); + $em->flush(); + } + +} \ No newline at end of file diff --git a/src/Service/ImovelService.php b/src/Service/ImovelService.php new file mode 100644 index 0000000..c77d076 --- /dev/null +++ b/src/Service/ImovelService.php @@ -0,0 +1,26 @@ +imovelRepository = $imovelRepository; + } + + public function salvar(Imovel $imovel) + { + $this->imovelRepository->salvar($imovel); + } +} \ No newline at end of file diff --git a/templates/listar_imoveis.html.twig b/templates/listar_imoveis.html.twig index 6af1973..e3b1d3b 100644 --- a/templates/listar_imoveis.html.twig +++ b/templates/listar_imoveis.html.twig @@ -47,7 +47,12 @@