Add migration to include site_name column in cities table
This commit is contained in:
@@ -142,6 +142,7 @@ class CategoryImporter
|
||||
$row['logo_url'] = self::optStr($raw['logo_url'] ?? null);
|
||||
break;
|
||||
case 'cities':
|
||||
$row['site_name'] = self::optStr($raw['site_name'] ?? null);
|
||||
$row['province_id'] = self::nullableId($raw['province_id'] ?? null, $add, 'province_id');
|
||||
$row['representation_id'] = self::nullableId($raw['representation_id'] ?? null, $add, 'representation_id');
|
||||
$row['contact_phone'] = self::optStr($raw['contact_phone'] ?? null);
|
||||
|
||||
@@ -223,6 +223,7 @@ class LocationController extends BaseController
|
||||
if (isset($data['weight'])) $city->setWeight((int) $data['weight']);
|
||||
if (array_key_exists('representation_id', $data))
|
||||
$city->setRepresentationId($data['representation_id'] !== null ? (int) $data['representation_id'] : null);
|
||||
if (array_key_exists('site_name', $data)) $city->setSiteName($data['site_name']);
|
||||
if (array_key_exists('contact_phone', $data)) $city->setContactPhone($data['contact_phone']);
|
||||
if (array_key_exists('email', $data)) $city->setEmail($data['email']);
|
||||
if (array_key_exists('description', $data)) $city->setDescription($data['description']);
|
||||
|
||||
@@ -24,6 +24,9 @@ class City
|
||||
#[ORM\Column(type: 'string', length: 255)]
|
||||
private string $name;
|
||||
|
||||
#[ORM\Column(name: 'site_name', type: 'string', length: 255, nullable: true)]
|
||||
private ?string $siteName = null;
|
||||
|
||||
#[ORM\Column(type: 'smallint')]
|
||||
private int $status = 1;
|
||||
|
||||
@@ -74,6 +77,7 @@ class City
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getUuid(): string { return $this->uuid; }
|
||||
public function getName(): string { return $this->name; }
|
||||
public function getSiteName(): ?string { return $this->siteName; }
|
||||
public function getStatus(): int { return $this->status; }
|
||||
public function getWeight(): int { return $this->weight; }
|
||||
public function getProvince(): ?Province { return $this->province; }
|
||||
@@ -89,6 +93,7 @@ class City
|
||||
public function getLogoUrl(): ?string { return $this->logoUrl; }
|
||||
|
||||
public function setName(string $v): self { $this->name = $v; return $this; }
|
||||
public function setSiteName(?string $v): self { $this->siteName = $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; }
|
||||
@@ -109,6 +114,7 @@ class City
|
||||
'id' => $this->id,
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'site_name' => $this->siteName,
|
||||
'status' => $this->status,
|
||||
'weight' => $this->weight,
|
||||
'province_id' => $this->province?->getId(),
|
||||
|
||||
Reference in New Issue
Block a user