src/Application/Internit/BlocoBundle/Entity/Bloco.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Application\Internit\BlocoBundle\Entity;
  3. use App\Application\Internit\BlocoBundle\Repository\BlocoRepository;
  4. use App\Application\Internit\EmpreendimentoBundle\Entity\Empreendimento;
  5. use App\Application\Internit\UnidadeBundle\Entity\Unidade;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use App\Entity\SonataMediaGallery;
  11. use App\Entity\SonataMediaMedia;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use DateTime;
  14. /** Info:  */
  15. #[ORM\Table(name'bloco')]
  16. #[ORM\Entity(repositoryClassBlocoRepository::class)]
  17. #[UniqueEntity('id')]
  18. class Bloco
  19. {
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue]
  22.     #[ORM\Column(name'id'type'integer'uniquetruenullablefalse)]
  23.     private ?int $id null;
  24.     #[ORM\Column(name'import_id'type'integer'uniquefalsenullabletrue)]
  25.     private ?int $importId;
  26.     #[ORM\Column(name'import'type'boolean'uniquefalsenullabletrue)]
  27.     private bool $import;
  28.     #[Assert\NotNull]
  29.     #[Assert\NotBlank]
  30.     #[ORM\Column(name'bloco'type'string'uniquefalsenullablefalse)]
  31.     private string $bloco;
  32.     #[ORM\Column(name'descricao'type'text'uniquefalsenullabletrue)]
  33.     private ?string $descricao null;
  34.     #[ORM\Column(name'visivel'type'boolean'uniquefalsenullabletrue)]
  35.     private ?bool $visivel null;
  36.     #[ORM\ManyToOne(targetEntityEmpreendimento::class, inversedBy'blocos')]
  37.     #[ORM\JoinColumn(name'empreendimento_id'referencedColumnName'id'onDelete'SET NULL')]
  38.     private Empreendimento|null $empreendimento null;
  39.     #[ORM\OneToMany(mappedBy'bloco'targetEntityUnidade::class)]
  40.     private Collection $unidades;
  41.     private int $qtdUnidades;
  42.     private string $empreendimentoBloco;
  43.     public function __construct()
  44.     {
  45.         $this->unidades = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     /**
  52.      * @return int|null
  53.      */
  54.     public function getImportId(): ?int
  55.     {
  56.         return $this->importId;
  57.     }
  58.     /**
  59.      * @param int|null $importId
  60.      */
  61.     public function setImportId(?int $importId): void
  62.     {
  63.         $this->importId $importId;
  64.     }
  65.     /**
  66.      * @return bool
  67.      */
  68.     public function isImport(): bool
  69.     {
  70.         return $this->import;
  71.     }
  72.     /**
  73.      * @param bool $import
  74.      */
  75.     public function setImport(bool $import): void
  76.     {
  77.         $this->import $import;
  78.     }
  79.     public function getBloco(): string
  80.     {
  81.         return $this->bloco;
  82.     }
  83.     public function setBloco(string $bloco): void
  84.     {
  85.         $this->bloco $bloco;
  86.     }
  87.     public function getDescricao(): ?string
  88.     {
  89.         return $this->descricao;
  90.     }
  91.     public function setDescricao(?string $descricao): void
  92.     {
  93.         $this->descricao $descricao;
  94.     }
  95.     public function getVisivel(): ?bool
  96.     {
  97.         return $this->visivel;
  98.     }
  99.     public function setVisivel(?bool $visivel): void
  100.     {
  101.         $this->visivel $visivel;
  102.     }
  103.     public function getEmpreendimento(): ?Empreendimento
  104.     {
  105.         return $this->empreendimento;
  106.     }
  107.     public function setEmpreendimento(?Empreendimento $empreendimento): void
  108.     {
  109.         $this->empreendimento $empreendimento;
  110.     }
  111.     public function getUnidades(): Collection
  112.     {
  113.         return $this->unidades;
  114.     }
  115.     public function setUnidades(Collection $unidades): void
  116.     {
  117.         $this->unidades $unidades;
  118.     }
  119.     public function getQtdUnidades(): int
  120.     {
  121.         return count($this->getUnidades());
  122.     }
  123.     public function getEmpreendimentoBloco(): string
  124.     {
  125.         $nomeEmpreendimento = ($this->getEmpreendimento()) ? $this->getEmpreendimento()->getNome() : '';
  126.         return $nomeEmpreendimento ' - bl. ' $this->getBloco();
  127.     }
  128. }