feat: add social media fields to Clinic entity and update API documentation

This commit is contained in:
hamed
2026-06-21 13:26:47 +03:30
parent 3f1b2de971
commit 57965f184d
7 changed files with 205 additions and 2 deletions
@@ -500,6 +500,18 @@ class ClinicController extends BaseController
$clinic->setCityId((int) $data['city'][0]);
}
if (array_key_exists('social_media', $data) && is_array($data['social_media'])) {
$allowedKeys = ['instagram', 'telegram', 'aparat', 'youtube', 'linkedin'];
$socialMedia = [];
foreach ($allowedKeys as $key) {
$value = $data['social_media'][$key] ?? null;
$socialMedia[$key] = (is_string($value) && filter_var($value, FILTER_VALIDATE_URL))
? $value
: null;
}
$clinic->setSocialMedia($socialMedia);
}
// Images stored as JSON (from upload response); gallery is capped at 5.
if (array_key_exists('image_clinic', $data) && is_array($data['image_clinic'])) {
$clinic->setImagesClinic(array_slice(array_values($data['image_clinic']), 0, self::MAX_GALLERY_IMAGES));
+6
View File
@@ -70,6 +70,9 @@ class Clinic
#[ORM\Column(name: 'images_clinic', type: 'json', nullable: true)]
private ?array $imagesClinic = null;
#[ORM\Column(name: 'social_media', type: 'json', nullable: true)]
private ?array $socialMedia = null;
#[ORM\Column(name: 'clinic_logo', type: 'string', length: 500, nullable: true)]
private ?string $clinicLogo = null;
@@ -142,6 +145,7 @@ class Clinic
public function getRepresentationId(): ?int { return $this->representationId; }
public function isActive(): bool { return $this->isActive; }
public function getImagesClinic(): ?array { return $this->imagesClinic; }
public function getSocialMedia(): ?array { return $this->socialMedia; }
public function getClinicLogo(): ?string { return $this->clinicLogo; }
public function getNotificationMobile(): ?string { return $this->notificationMobile; }
public function getCreatedAt(): int { return $this->createdAt; }
@@ -174,6 +178,7 @@ class Clinic
public function setRepresentationId(?int $v): self { $this->representationId = $v; $this->touch(); return $this; }
public function setIsActive(bool $v): self { $this->isActive = $v; $this->touch(); return $this; }
public function setImagesClinic(?array $v): self { $this->imagesClinic = $v; $this->touch(); return $this; }
public function setSocialMedia(?array $v): self { $this->socialMedia = $v; $this->touch(); return $this; }
public function setClinicLogo(?string $v): self { $this->clinicLogo = $v; $this->touch(); return $this; }
public function setNotificationMobile(?string $v): self { $this->notificationMobile = $v; $this->touch(); return $this; }
@@ -190,6 +195,7 @@ class Clinic
'phone' => $this->telephone,
'logo' => $this->clinicLogo,
'images_clinic' => $this->imagesClinic ?? [],
'social_media' => $this->socialMedia,
'clinic_logo' => $this->clinicLogo,
'phone_number' => $this->telephone,
'caption' => $this->info,