uuid = Uuid::v4()->toRfc4122(); $this->user = $user; $this->createdAt = time(); $this->updatedAt = time(); $this->doctors = new ArrayCollection(); $this->specialties = new ArrayCollection(); $this->services = new ArrayCollection(); $this->insurances = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getUser(): User { return $this->user; } public function getName(): ?string { return $this->name; } public function getInfo(): ?string { return $this->info; } public function getAddress(): ?string { return $this->address; } public function getTelephone(): ?string { return $this->telephone; } public function isIs247(): bool { return $this->is247; } public function getWorkingDays(): ?string { return $this->workingDays; } public function getLatitude(): ?float { return $this->latitude; } public function getLongitude(): ?float { return $this->longitude; } public function getCityId(): ?int { return $this->cityId; } public function getStateId(): ?int { return $this->stateId; } public function getRepresentationId(): ?int { return $this->representationId; } public function getImagesClinic(): ?array { return $this->imagesClinic; } public function getClinicLogo(): ?array { return $this->clinicLogo; } public function getDoctors(): Collection { return $this->doctors; } public function getSpecialties(): Collection { return $this->specialties; } public function getServices(): Collection { return $this->services; } public function getInsurances(): Collection { return $this->insurances; } public function setName(?string $v): self { $this->name = $v; $this->touch(); return $this; } public function setInfo(?string $v): self { $this->info = $v; $this->touch(); return $this; } public function setAddress(?string $v): self { $this->address = $v; $this->touch(); return $this; } public function setTelephone(?string $v): self { $this->telephone = $v; $this->touch(); return $this; } public function setIs247(bool $v): self { $this->is247 = $v; $this->touch(); return $this; } public function setWorkingDays(?string $v): self { $this->workingDays = $v; $this->touch(); return $this; } public function setLatitude(?float $v): self { $this->latitude = $v; $this->touch(); return $this; } public function setLongitude(?float $v): self { $this->longitude = $v; $this->touch(); return $this; } public function setCityId(?int $v): self { $this->cityId = $v; $this->touch(); return $this; } public function setStateId(?int $v): self { $this->stateId = $v; $this->touch(); return $this; } public function setRepresentationId(?int $v): self { $this->representationId = $v; $this->touch(); return $this; } public function setImagesClinic(?array $v): self { $this->imagesClinic = $v; $this->touch(); return $this; } public function setClinicLogo(?array $v): self { $this->clinicLogo = $v; $this->touch(); return $this; } private function touch(): void { $this->updatedAt = time(); } public function toDetailArray(array $stateData = [], array $cityData = []): array { $formatCat = fn(Category $c) => [ 'uuid' => $c->getUuid(), 'id' => (string) $c->getId(), 'name' => $c->getLabel(), ]; $formatCatWithParent = fn(Category $c) => [ 'uuid' => $c->getUuid(), 'id' => (string) $c->getId(), 'name' => $c->getLabel(), 'parent' => $c->getParentId() !== null ? (string) $c->getParentId() : null, ]; return [ 'id' => (string) $this->id, 'uuid' => $this->uuid, 'title' => $this->name, 'images_clinic' => $this->imagesClinic ?? [], 'clinic_logo' => $this->clinicLogo ?? [], 'phone_number' => $this->telephone, 'caption' => $this->info, 'list_bime' => array_map($formatCat, $this->insurances->toArray()), 'specialties' => array_map($formatCatWithParent, $this->specialties->toArray()), 'services' => array_map($formatCat, $this->services->toArray()), 'clinic_specialty' => array_map($formatCatWithParent, $this->specialties->toArray()), 'doctors' => $this->doctors->count(), 'doctor_list' => null, 'city' => $cityData ? [$cityData] : [], 'state' => $stateData ? [$stateData] : [], 'location' => $this->address, 'map' => [ 'latitude' => $this->latitude !== null ? (string) $this->latitude : null, 'longitude' => $this->longitude !== null ? (string) $this->longitude : null, ], '24_7' => $this->is247, 'field_working_days' => $this->workingDays, ]; } public function toListArray(): array { $formatCat = fn(Category $c) => [ 'uuid' => $c->getUuid(), 'id' => (string) $c->getId(), 'name' => $c->getLabel(), ]; return [ 'id' => (string) $this->id, 'uuid' => $this->uuid, 'title' => $this->name, 'images_clinic' => $this->imagesClinic ?? [], 'clinic_logo' => $this->clinicLogo ?? [], 'phone_number' => $this->telephone, 'specialties' => array_map($formatCat, $this->specialties->toArray()), 'doctors' => $this->doctors->count(), '24_7' => $this->is247, ]; } }