src/Entity/Building.php line 34
<?phpnamespace App\Entity;use DateTime;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Serializer\Annotation\Ignore;#[ORM\Table(name: 'building')]#[ORM\UniqueConstraint(name: 'uniq_user_id_building_code', columns: ['user_id', 'code'])]#[ORM\Index(columns: ['address'])]#[ORM\Entity(repositoryClass: 'App\Repository\BuildingRepository')]#[UniqueEntity(fields: ['code', 'user'],errorPath: 'code',message: 'Ovaj kod zgrade je već u upotrebi.')]class Building{public const PROFESSIONAL_MANAGEMENT = 0;public const COMPULSORY_MANAGEMENT = 1;public const TENANT_MANAGEMENT = 2;/*** @var array<string>*/#[Ignore]public static array $DATATABLE_ORDER = ['code','address','type','flats','buildingSize','population','constructionYear','comment','management','elevator'];#[ORM\Column(name: 'id', type: 'integer')]#[ORM\Id]#[ORM\GeneratedValue(strategy: 'AUTO')]private int $id;#[ORM\Column(name: 'comment', type: 'string', length: 512, nullable: true)]private string|null $comment;#[ORM\Column(name: 'created_at', type: 'datetime', nullable: true)]private DateTime|null $createdAt;#[ORM\Column(name: 'updated_at', type: 'datetime', nullable: true)]private DateTime|null $updatedAt;#[Assert\Length(min: 2,max: 7,minMessage: 'Kod zgrade treba da ima minimum {{ limit }} karaktera.',maxMessage: 'Kod zgrade treba da ima maksimalno {{ limit }} karaktera.')]#[Assert\NotBlank]#[ORM\Column(name: 'code', type: 'string', length: 64, nullable: true)]private string|null $code;#[ORM\Column(name: 'address', type: 'string', length: 255, nullable: true)]private string|null $address;#[ORM\Column(name: 'mat_id', type: 'string', length: 64, nullable: true)]private string|null $matId;#[ORM\Column(name: 'pib', type: 'string', length: 64, nullable: true)]private string|null $pib;#[ORM\Column(name: 'startingMoney', type: 'float', nullable: true, options: ['default' => 0.0])]private float|null $startingMoney;#[ORM\Column(name: 'bank_account', type: 'string', length: 128, nullable: true)]#[Assert\NotBlank]private string|null $bankAccount;#[ORM\Column(name: 'flats', type: 'integer', nullable: true, options: ['default' => 0])]private int|null $flats;#[ORM\Column(name: 'building_size', type: 'float', nullable: true, options: ['default' => 0.0])]private float|null $buildingSize;#[ORM\Column(name: 'population', type: 'integer', nullable: true, options: ['default' => 0])]private int|null $population;#[ORM\ManyToOne(targetEntity: 'App\Entity\User', cascade: ['persist'])]#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]#[Ignore]private User $user;#[Assert\NotBlank]#[ORM\Column(name: 'post_code', type: 'string', length: 64, nullable: true)]#[Ignore]private string|null $postCode = '';#[Assert\NotBlank]#[ORM\Column(name: 'city', type: 'string', length: 64, nullable: true)]private string|null $city = '';#[Assert\NotBlank]#[ORM\Column(name: 'municipality', type: 'string', length: 64, nullable: true)]private string|null $municipality = '';#[ORM\Column(name: 'type', type: 'integer', nullable: true, options: ['default' => 1])]private int|null $type;/*** @var Collection<int, Equipment>*/#[ORM\OneToMany(targetEntity: 'Equipment', mappedBy: 'building')]#[Ignore]private Collection $equipment;/*** @var Collection<int, BuildingDictionary>*/#[ORM\OneToMany(targetEntity: 'BuildingDictionary', mappedBy: 'building', cascade: ['remove'])]#[Ignore]private Collection $buildingDictionaries;#[ORM\ManyToOne(targetEntity: 'App\Entity\Building', cascade: ['persist'])]#[ORM\JoinColumn(name: 'building_id_bs', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]#[Ignore]private Building|null $buildingIdBs;#[Assert\Email(message: "The email '{{ value }}' is not a valid email.")]#[ORM\Column(name: 'email', type: 'string', nullable: true)]private string|null $email = null;#[ORM\OneToOne(targetEntity: 'Flat')]#[ORM\JoinColumn(name: 'main_flat_id', referencedColumnName: 'id', nullable: true)]#[Ignore]private Flat|null $mainFlat;#[ORM\Column(name: 'construction_year', type: 'string', length: 64, nullable: true)]private string|null $constructionYear;#[ORM\Column(name: 'active_status', type: 'integer', nullable: false, options: ['default' => 1])]private int $activeStatus;#[ORM\Column(name: 'createdBy', type: 'string', nullable: true)]private string|null $createdBy;#[ORM\Column(name: 'enableFlatUserCreate', type: 'boolean', options: ['default' => false])]private bool $enableFlatUserCreate = false;#[ORM\Column(name: 'elevator', type: 'integer', nullable: true, options: ['default' => null])]private int|null $elevator;#[ORM\Column(name: 'building_servicing', type: 'string', length: 64, nullable: true, options: ['default' => null])]private string|null $buildingServicing;#[ORM\Column(name: 'management', type: 'integer', nullable: true)]private int|null $management;/*** @return string*/public function getCreatedBy(): string{return $this->createdBy;}public function __construct(){$this->equipment = new ArrayCollection();$this->buildingDictionaries = new ArrayCollection();}/*** @return bool*/public function isEnableFlatUserCreate(): bool{return $this->enableFlatUserCreate;}/*** @param bool $enableFlatUserCreate*/public function setEnableFlatUserCreate(bool $enableFlatUserCreate): void{$this->enableFlatUserCreate = $enableFlatUserCreate;}/*** @return Flat|null*/public function getMainFlat(): ?Flat{return $this->mainFlat;}/*** @param Flat|null $mainFlat*/public function setMainFlat(?Flat $mainFlat): void{$this->mainFlat = $mainFlat;}/*** @return float|null*/public function getStartingMoney(): ?float{return $this->startingMoney;}/*** @param float|null $startingMoney*/public function setStartingMoney(?float $startingMoney): void{$this->startingMoney = $startingMoney;}/*** @return Collection<int, Equipment>*/public function getEquipment(): Collection{return $this->equipment;}/*** @param Equipment $equip* @return void*/public function setEquipment(Equipment $equip): void{$this->equipment[] = $equip;}/*** @return Collection<int, BuildingDictionary>*/#[Ignore]public function getBuildingDictionaries(): Collection{return $this->buildingDictionaries;}/*** @param BuildingDictionary $buildingDictionary* @return void*/#[Ignore]public function setBuildingDictionary(BuildingDictionary $buildingDictionary): void{$this->buildingDictionaries[] = $buildingDictionary;}/*** Get id** @return int*/public function getId(): int{return $this->id;}/*** @param string|null $comment** @return $this*/public function setComment(?string $comment): self{$this->comment = $comment;return $this;}/*** Get comment** @return string|null*/public function getComment(): ?string{return $this->comment;}/*** @return string|null*/public function getPostCode(): ?string{return $this->postCode;}/*** @param string|null $postCode*/public function setPostCode(?string $postCode): void{$this->postCode = $postCode;}/*** @return string|null*/public function getCity(): ?string{return $this->city;}/*** @param string|null $city*/public function setCity(?string $city): void{$this->city = $city;}/*** @return string|null*/public function getMunicipality(): ?string{return $this->municipality;}/*** @param string|null $municipality*/public function setMunicipality(?string $municipality): void{$this->municipality = $municipality;}/*** Set address** @param string|null $address** @return Building*/public function setAddress(?string $address): Building{$this->address = $address;return $this;}/*** @return Building|null*/public function getBuildingIdBs(): ?Building{return $this->buildingIdBs;}/*** @param Building|null $buildingIdBs*/public function setBuildingIdBs(?Building $buildingIdBs): void{$this->buildingIdBs = $buildingIdBs;}/*** Get address** @return string|null*/public function getAddress(): ?string{return $this->address;}/*** Set flats** @param int|null $flats** @return Building*/public function setFlats(?int $flats): Building{$this->flats = $flats;return $this;}/*** Get flats** @return int|null*/public function getFlats(): ?int{return $this->flats;}/*** @param float|null $buildingSize** @return $this*/public function setBuildingSize(?float $buildingSize): self{$this->buildingSize = $buildingSize;return $this;}/*** Get population** @return int|null*/public function getPopulation(): ?int{return $this->population;}/*** Set pupulation** @param int|null $population** @return Building*/public function setPopulation(?int $population): Building{$this->population = $population;return $this;}/*** Get buildingSize** @return float|null*/public function getBuildingSize(): ?float{return $this->buildingSize;}/*** @return User*/public function getUser(): User{return $this->user;}/*** @param User $user*/public function setUser(User $user): void{$this->user = $user;if (empty($this->createdBy)) {$this->createdBy = $user->getCreatedByValue();}}/*** @return int|null*/public function getType(): ?int{return $this->type;}/*** @param int|null $type*/public function setType(?int $type): void{$this->type = $type;}/*** @param int $increment*/public function incrementPopulation(int $increment): void{$this->population = $this->population + $increment;}/*** @param int $decrement*/public function decrementPopulation(int $decrement): void{$this->population = $this->population - $decrement;}/*** @param int|float $decrement*/public function decrementBuildingSize(int|float $decrement): void{$this->buildingSize -= $decrement;}/*** @param int $changeSize*/public function changeSumSize(int $changeSize): void{$this->buildingSize = $this->buildingSize + $changeSize;}/*** Set code** @param string|null $code** @return Building*/public function setCode(?string $code): self{$this->code = $code;return $this;}/*** Get code** @return string|null*/public function getCode(): ?string{return $this->code;}/*** Set pib** @param string|null $pib** @return Building*/public function setPib(?string $pib): self{$this->pib = $pib;return $this;}/*** Get code** @return string|null*/public function getPib(): ?string{return $this->pib;}/*** Set matId** @param string|null $matId** @return Building*/public function setMatId(?string $matId): Building{$this->matId = $matId;return $this;}/*** Get matId** @return string|null*/public function getMatId(): ?string{return $this->matId;}/*** @return string|null*/public function getEmail(): ?string{return $this->email;}/*** @param string|null $email*/public function setEmail(?string $email): void{$this->email = $email;}/*** Set bankAccount** @param string|null $bankAccount** @return Building*/public function setBankAccount(?string $bankAccount): Building{$this->bankAccount = $bankAccount;return $this;}/*** Get bankAccount** @return string|null*/public function getBankAccount(): ?string{return $this->bankAccount;}/****/public function incrementFlatsNumber(): void{$this->flats++;}/****/public function decrementFlatsNumber(): void{$this->flats--;}public function secretBillNumber(): string{return sprintf("%s%s", mb_substr($this->getAddress(), 0, 2), $this->getId());}/*** @return DateTime|null*/public function getCreatedAt(): ?DateTime{return $this->createdAt;}/*** @param DateTime|null $createdAt*/public function setCreatedAt(?DateTime $createdAt): void{$this->createdAt = $createdAt;}/*** @return DateTime|null*/public function getUpdatedAt(): ?DateTime{return $this->updatedAt;}/*** @param DateTime|null $updatedAt*/public function setUpdatedAt(?DateTime $updatedAt): void{$this->updatedAt = $updatedAt;}/*** @return string|null*/public function getConstructionYear(): ?string{return $this->constructionYear;}/*** @param string|null $constructionYear*/public function setConstructionYear(?string $constructionYear): void{$this->constructionYear = $constructionYear;}/*** @return int*/public function getActiveStatus(): int{return $this->activeStatus;}/*** @param int $activeStatus*/public function setActiveStatus(int $activeStatus): void{$this->activeStatus = $activeStatus;}/*** @return int|null*/public function getElevator(): ?int{return $this->elevator;}/*** @param int|null $elevator*/public function setElevator(?int $elevator): void{$this->elevator = $elevator;}/*** @return string|null*/public function getBuildingServicing(): ?string{return $this->buildingServicing;}/*** @param string|null $buildingServicing*/public function setBuildingServicing(?string $buildingServicing): void{$this->buildingServicing = $buildingServicing;}/*** @return int|null*/public function isManagement(): ?int{return $this->management;}/*** @param int|null $management*/public function setManagement(?int $management): void{$this->management = $management;}public function __toString(){return (string) $this->getAddress();}}