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.
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace App\Location\Entity;
|
||||
|
||||
use App\Location\Repository\CityRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CityRepository::class)]
|
||||
#[ORM\Table(name: 'cities')]
|
||||
#[ORM\Index(columns: ['province_id'], name: 'idx_cities_province')]
|
||||
#[ORM\Index(columns: ['status'], name: 'idx_cities_status')]
|
||||
#[ORM\Index(columns: ['representation_id'], name: 'idx_cities_representation')]
|
||||
class City
|
||||
{
|
||||
#[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: 'smallint')]
|
||||
private int $status = 1;
|
||||
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private int $weight = 0;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Province::class)]
|
||||
#[ORM\JoinColumn(name: 'province_id', referencedColumnName: 'id', nullable: true)]
|
||||
private ?Province $province = null;
|
||||
|
||||
#[ORM\Column(name: 'representation_id', type: 'integer', nullable: true)]
|
||||
private ?int $representationId = null;
|
||||
|
||||
#[ORM\Column(name: 'contact_phone', type: 'string', length: 255, nullable: true)]
|
||||
private ?string $contactPhone = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(type: 'text', nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private ?string $slogan = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private ?string $domain = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 255, nullable: true)]
|
||||
private ?string $keywords = null;
|
||||
|
||||
#[ORM\Column(name: 'footer_description', type: 'text', nullable: true)]
|
||||
private ?string $footerDescription = null;
|
||||
|
||||
#[ORM\Column(name: 'social_media', type: 'json', nullable: true)]
|
||||
private ?array $socialMedia = null;
|
||||
|
||||
#[ORM\Column(name: 'logo_url', type: 'string', length: 500, nullable: true)]
|
||||
private ?string $logoUrl = null;
|
||||
|
||||
public function __construct(string $name, ?Province $province = null)
|
||||
{
|
||||
$this->uuid = Uuid::v4()->toRfc4122();
|
||||
$this->name = $name;
|
||||
$this->province = $province;
|
||||
}
|
||||
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getUuid(): string { return $this->uuid; }
|
||||
public function getName(): string { return $this->name; }
|
||||
public function getStatus(): int { return $this->status; }
|
||||
public function getWeight(): int { return $this->weight; }
|
||||
public function getProvince(): ?Province { return $this->province; }
|
||||
public function getRepresentationId(): ?int { return $this->representationId; }
|
||||
public function getContactPhone(): ?string { return $this->contactPhone; }
|
||||
public function getEmail(): ?string { return $this->email; }
|
||||
public function getDescription(): ?string { return $this->description; }
|
||||
public function getSlogan(): ?string { return $this->slogan; }
|
||||
public function getDomain(): ?string { return $this->domain; }
|
||||
public function getKeywords(): ?string { return $this->keywords; }
|
||||
public function getFooterDescription(): ?string { return $this->footerDescription; }
|
||||
public function getSocialMedia(): ?array { return $this->socialMedia; }
|
||||
public function getLogoUrl(): ?string { return $this->logoUrl; }
|
||||
|
||||
public function setName(string $v): self { $this->name = $v; return $this; }
|
||||
public function setStatus(int $v): self { $this->status = $v; return $this; }
|
||||
public function setWeight(int $v): self { $this->weight = $v; return $this; }
|
||||
public function setProvince(?Province $v): self { $this->province = $v; return $this; }
|
||||
public function setRepresentationId(?int $v): self { $this->representationId = $v; return $this; }
|
||||
public function setContactPhone(?string $v): self { $this->contactPhone = $v; return $this; }
|
||||
public function setEmail(?string $v): self { $this->email = $v; return $this; }
|
||||
public function setDescription(?string $v): self { $this->description = $v; return $this; }
|
||||
public function setSlogan(?string $v): self { $this->slogan = $v; return $this; }
|
||||
public function setDomain(?string $v): self { $this->domain = $v; return $this; }
|
||||
public function setKeywords(?string $v): self { $this->keywords = $v; return $this; }
|
||||
public function setFooterDescription(?string $v): self { $this->footerDescription = $v; return $this; }
|
||||
public function setSocialMedia(?array $v): self { $this->socialMedia = $v; return $this; }
|
||||
public function setLogoUrl(?string $v): self { $this->logoUrl = $v; return $this; }
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'status' => $this->status,
|
||||
'weight' => $this->weight,
|
||||
'province_id' => $this->province?->getId(),
|
||||
'province_name' => $this->province?->getName(),
|
||||
'representation_id' => $this->representationId,
|
||||
'contact_phone' => $this->contactPhone,
|
||||
'email' => $this->email,
|
||||
'description' => $this->description,
|
||||
'slogan' => $this->slogan,
|
||||
'domain' => $this->domain,
|
||||
'keywords' => $this->keywords,
|
||||
'footer_description' => $this->footerDescription,
|
||||
'social_media' => $this->socialMedia,
|
||||
'logo_url' => $this->logoUrl,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Location\Entity;
|
||||
|
||||
use App\Location\Repository\ProvinceRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ProvinceRepository::class)]
|
||||
#[ORM\Table(name: 'provinces')]
|
||||
#[ORM\Index(columns: ['status'], name: 'idx_provinces_status')]
|
||||
class Province
|
||||
{
|
||||
#[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: 'smallint')]
|
||||
private int $status = 1;
|
||||
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private int $weight = 0;
|
||||
|
||||
public function __construct(string $name)
|
||||
{
|
||||
$this->uuid = Uuid::v4()->toRfc4122();
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getUuid(): string { return $this->uuid; }
|
||||
public function getName(): string { return $this->name; }
|
||||
public function getStatus(): int { return $this->status; }
|
||||
public function getWeight(): int { return $this->weight; }
|
||||
|
||||
public function setName(string $v): self { $this->name = $v; return $this; }
|
||||
public function setStatus(int $v): self { $this->status = $v; return $this; }
|
||||
public function setWeight(int $v): self { $this->weight = $v; return $this; }
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'status' => $this->status,
|
||||
'weight' => $this->weight,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user