src/Application/Internit/EmpreendimentoBundle/Entity/Empreendimento.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Application\Internit\EmpreendimentoBundle\Entity;
  3. use App\Application\Internit\EmpreendimentoBundle\Repository\EmpreendimentoRepository;
  4. use App\Application\Internit\StatusEmpreendimentoBundle\Entity\StatusEmpreendimento;
  5. use App\Application\Internit\BlocoBundle\Entity\Bloco;
  6. use App\Application\Internit\AcompanhamentoBundle\Entity\Acompanhamento;
  7. use App\Application\Internit\GaleriaEmpreendimentoBundle\Entity\GaleriaEmpreendimento;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use App\Entity\SonataMediaGallery;
  13. use App\Entity\SonataMediaMedia;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use DateTime;
  16. /** Info:  */
  17. #[ORM\Table(name'empreendimento')]
  18. #[ORM\Entity(repositoryClassEmpreendimentoRepository::class)]
  19. #[UniqueEntity('id')]
  20. class Empreendimento
  21. {
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column(name'id'type'integer'uniquetruenullablefalse)]
  25.     private ?int $id null;
  26.     #[ORM\Column(name'import_id'type'integer'uniquefalsenullabletrue)]
  27.     private ?int $importId;
  28.     #[ORM\Column(name'import'type'boolean'uniquefalsenullabletrue)]
  29.     private bool $import;
  30.     #[Assert\NotNull]
  31.     #[Assert\NotBlank]
  32.     #[ORM\Column(name'nome'type'string'uniquefalsenullablefalse)]
  33.     private string $nome;
  34.     #[ORM\Column(name'descricao'type'text'uniquefalsenullabletrue)]
  35.     private ?string $descricao null;
  36.     #[ORM\Column(name'visivel'type'boolean'uniquefalsenullabletrue)]
  37.     private ?bool $visivel null;
  38.     #[ORM\ManyToOne(targetEntitySonataMediaMedia::class, cascade: ['persist'])]
  39.     private mixed $logo;
  40.     #[ORM\ManyToOne(targetEntityStatusEmpreendimento::class)]
  41.     #[ORM\JoinColumn(name'statusEmpreendimento_id'referencedColumnName'id'onDelete'SET NULL')]
  42.     private StatusEmpreendimento|null $statusEmpreendimento null;
  43.     #[ORM\OneToMany(mappedBy'empreendimento'targetEntityBloco::class)]
  44.     private Collection $blocos;
  45.     #[ORM\OneToMany(mappedBy'empreendimento'targetEntityAcompanhamento::class)]
  46.     private Collection $acompanhamentos;
  47.     #[ORM\OneToMany(mappedBy'empreendimento'targetEntityGaleriaEmpreendimento::class)]
  48.     private Collection $galeriaEmpreendimentos;
  49.     private int $qtdBlocos 0;
  50.     private int $qtdUnidades 0;
  51.     public function __construct()
  52.     {
  53.         $this->blocos = new ArrayCollection();
  54.         $this->acompanhamentos = new ArrayCollection();
  55.         $this->galeriaEmpreendimentos = new ArrayCollection();
  56.     }
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     /**
  62.      * @return ?int
  63.      */
  64.     public function getImportId(): ?int
  65.     {
  66.         return $this->importId;
  67.     }
  68.     /**
  69.      * @param ?int $importId
  70.      */
  71.     public function setImportId(?int $importId): void
  72.     {
  73.         $this->importId $importId;
  74.     }
  75.     /**
  76.      * @return bool
  77.      */
  78.     public function isImport(): bool
  79.     {
  80.         return $this->import;
  81.     }
  82.     /**
  83.      * @param bool $import
  84.      */
  85.     public function setImport(bool $import): void
  86.     {
  87.         $this->import $import;
  88.     }
  89.     public function getNome(): string
  90.     {
  91.         return $this->nome;
  92.     }
  93.     public function setNome(string $nome): void
  94.     {
  95.         $this->nome $nome;
  96.     }
  97.     public function getDescricao(): ?string
  98.     {
  99.         return $this->descricao;
  100.     }
  101.     public function setDescricao(?string $descricao): void
  102.     {
  103.         $this->descricao $descricao;
  104.     }
  105.     public function getVisivel(): ?bool
  106.     {
  107.         return $this->visivel;
  108.     }
  109.     public function setVisivel(?bool $visivel): void
  110.     {
  111.         $this->visivel $visivel;
  112.     }
  113.     public function getLogo(): mixed
  114.     {
  115.         return $this->logo;
  116.     }
  117.     public function setLogo(mixed $logo): void
  118.     {
  119.         $this->logo $logo;
  120.     }
  121.     public function getStatusEmpreendimento(): ?StatusEmpreendimento
  122.     {
  123.         return $this->statusEmpreendimento;
  124.     }
  125.     public function setStatusEmpreendimento(?StatusEmpreendimento $statusEmpreendimento): void
  126.     {
  127.         $this->statusEmpreendimento $statusEmpreendimento;
  128.     }
  129.     public function getBlocos(): Collection
  130.     {
  131.         return $this->blocos;
  132.     }
  133.     public function setBlocos(Collection $blocos): void
  134.     {
  135.         $this->blocos $blocos;
  136.     }
  137.     public function getAcompanhamentos(): Collection
  138.     {
  139.         return $this->acompanhamentos;
  140.     }
  141.     public function setAcompanhamentos(Collection $acompanhamentos): void
  142.     {
  143.         $this->acompanhamentos $acompanhamentos;
  144.     }
  145.     public function getGaleriaEmpreendimentos(): Collection
  146.     {
  147.         return $this->galeriaEmpreendimentos;
  148.     }
  149.     public function setGaleriaEmpreendimentos(Collection $galeriaEmpreendimentos): void
  150.     {
  151.         $this->galeriaEmpreendimentos $galeriaEmpreendimentos;
  152.     }
  153.     public function getQtdBlocos(): int
  154.     {
  155.         return count($this->getBlocos());
  156.     }
  157.     public function getQtdUnidades(): int
  158.     {
  159.         foreach ($this->getBlocos() as $bloco) {
  160.             $this->qtdUnidades += count($bloco->getUnidades());
  161.         }
  162.         return $this->qtdUnidades;
  163.     }
  164. }