Files
clinicpro/src/Insurance/Entity/Insurance.php
T
hamed 5066fcbd91 feat: add insurance and location management
- Introduced InsuranceType enum for insurance categorization.
- Created InsuranceRepository for managing insurance entities.
- Developed LocationController for handling provinces and cities, including CRUD operations.
- Implemented City and Province entities with necessary fields and relationships.
- Added CityRepository and ProvinceRepository for database interactions.
- Established Specialty management with SpecialtyController, including CRUD operations.
- Created Specialty and Tag entities with appropriate fields and relationships.
- Implemented TagController for managing tags, including CRUD operations.
- Added TagRepository for database interactions with tags.
2026-06-10 14:22:26 +03:30

67 lines
2.2 KiB
PHP

<?php
namespace App\Insurance\Entity;
use App\Insurance\Enum\InsuranceType;
use App\Insurance\Repository\InsuranceRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: InsuranceRepository::class)]
#[ORM\Table(name: 'insurances')]
#[ORM\Index(columns: ['type'], name: 'idx_insurances_type')]
#[ORM\Index(columns: ['status'], name: 'idx_insurances_status')]
class Insurance
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 36, unique: true)]
private string $uuid;
#[ORM\Column(type: 'string', length: 255)]
private string $name;
#[ORM\Column(type: 'string', length: 20, enumType: InsuranceType::class)]
private InsuranceType $type;
#[ORM\Column(name: 'logo_url', type: 'string', length: 500, nullable: true)]
private ?string $logoUrl = null;
#[ORM\Column(type: 'smallint')]
private int $status = 1;
public function __construct(string $name, InsuranceType $type)
{
$this->uuid = Uuid::v4()->toRfc4122();
$this->name = $name;
$this->type = $type;
}
public function getId(): ?int { return $this->id; }
public function getUuid(): string { return $this->uuid; }
public function getName(): string { return $this->name; }
public function getType(): InsuranceType { return $this->type; }
public function getLogoUrl(): ?string { return $this->logoUrl; }
public function getStatus(): int { return $this->status; }
public function setName(string $v): self { $this->name = $v; return $this; }
public function setType(InsuranceType $v): self { $this->type = $v; return $this; }
public function setLogoUrl(?string $v): self { $this->logoUrl = $v; return $this; }
public function setStatus(int $v): self { $this->status = $v; return $this; }
public function toArray(): array
{
return [
'id' => $this->id,
'uuid' => $this->uuid,
'name' => $this->name,
'type' => $this->type->value,
'logo_url' => $this->logoUrl,
'status' => $this->status,
];
}
}