From 699b9948861d4975e2c18b401c89992ccf4b3183 Mon Sep 17 00:00:00 2001 From: Kennety Andersson Date: Sun, 16 Jun 2019 12:42:49 -0300 Subject: [PATCH] Projeto final --- data/database.sqlite | Bin 20480 -> 20480 bytes src/Controller/ImovelController.php | 13 +++ src/Entity/ContratoAdm.php | 111 +++++++++++++++++++ src/Entity/ContratoLocacao.php | 163 ++++++++++++++++++++++++++++ src/Entity/Imovel.php | 50 +++++++-- src/Repository/ImovelRepository.php | 28 +++++ src/Service/ImovelService.php | 26 +++++ templates/listar_imoveis.html.twig | 7 +- 8 files changed, 388 insertions(+), 10 deletions(-) create mode 100644 src/Entity/ContratoAdm.php create mode 100644 src/Entity/ContratoLocacao.php create mode 100644 src/Repository/ImovelRepository.php create mode 100644 src/Service/ImovelService.php diff --git a/data/database.sqlite b/data/database.sqlite index 6804099194477c98dfb0bd95dbcdc352559b3065..aade635e45c29529fef899641066a4d09ccd3615 100755 GIT binary patch delta 59 zcmZozz}T>Wae_3X!$cWpRtE+>#>kB+bM^W8_cJi_H8Jp)@crg%;%nM0Xi&(vxzWy! Pk%fVQ!Ey6pds_hj^%4+N delta 59 zcmZozz}T>Wae_3X{X`jOR(l3LnGG9L=IZk^Ffg$2H8Jq-=P%*=&DXS9(4dfSbEBOd PBa1yF2gByW_O=25@@Wt} 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 @@ {{ imovel.endereco.logradouro }} - + + + + + + {% endfor %}