Skip to content

Commit

Permalink
feat: add updated_at and deleted_at fields to model mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
0x1026 committed Dec 10, 2024
1 parent 00492f8 commit 5128e76
Show file tree
Hide file tree
Showing 21 changed files with 107 additions and 51 deletions.
43 changes: 28 additions & 15 deletions app/src/app/Models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ abstract class BaseModel

protected ?string $created_at;

protected ?string $updated_at;

protected ?string $deleted_at;

// Insert multiple records into the table
public static function bulkInsert(array $records): void
{
Expand All @@ -21,8 +25,7 @@ public static function bulkInsert(array $records): void
$query .= implode(", ", array_fill(0, count($records), "(" . implode(", ", $placeholders) . ")"));

$params = [];
foreach ($records as $index => $record)
foreach ($record as $key => $value)
foreach ($records as $index => $record) foreach ($record as $key => $value)

Check warning on line 28 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L28

Added line #L28 was not covered by tests
$params["{$key}_{$index}"] = $value;

Database::prepareAndExecute($query, $params);
Expand All @@ -40,7 +43,7 @@ public function belongsTo(string $relatedModel, string $foreignKey, string $owne
$query = "SELECT * FROM {$relatedTable} WHERE {$ownerKey} = :foreignKeyValue LIMIT 1";
$results = Database::prepareAndExecute($query, ['foreignKeyValue' => $foreignKeyValue]);

return ! empty($results) ? $relatedModel::mapDataToModel($results[0]) : null;
return !empty($results) ? $relatedModel::mapDataToModel($results[0]) : null;

Check warning on line 46 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L46

Added line #L46 was not covered by tests
}

// Many-to-Many relationship
Expand Down Expand Up @@ -75,7 +78,7 @@ public function belongsToMany(

$results = Database::prepareAndExecute($query, ['localKeyValue' => $localKeyValue]);

if (! is_array($results))
if (!is_array($results))

Check warning on line 81 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L81

Added line #L81 was not covered by tests
$results = [];

// Process results
Expand All @@ -85,7 +88,7 @@ public function belongsToMany(
if ($withPivot) {
// Attach pivot data as a property
$relatedInstance->pivot = array_filter($row, function ($key) use ($relatedModel) {
return ! property_exists($relatedModel, $key);
return !property_exists($relatedModel, $key);

Check warning on line 91 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L91

Added line #L91 was not covered by tests
}, ARRAY_FILTER_USE_KEY);
}

Expand All @@ -99,7 +102,7 @@ public static function count(array $conditions = []): ?int
$query = "SELECT COUNT(*) as count FROM " . static::getTableName();
$params = [];

if (! empty($conditions)) {
if (!empty($conditions)) {

Check warning on line 105 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L105

Added line #L105 was not covered by tests
$query .= " WHERE ";
$query .= implode(' AND ', array_map(function ($key) {
return "$key = :$key";
Expand Down Expand Up @@ -156,7 +159,7 @@ public static function find(string $id): ?object

$results = Database::prepareAndExecute($query, ['id' => $id]);

return ! empty($results) ? static::mapDataToModel($results[0]) : null;
return !empty($results) ? static::mapDataToModel($results[0]) : null;

Check warning on line 162 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L162

Added line #L162 was not covered by tests
}

// Fetch all records from the table
Expand Down Expand Up @@ -206,7 +209,7 @@ public static function findBy(array $conditions, bool $single = false): array|ob
$results = Database::prepareAndExecute($query, $parameters);

if ($single)
return ! empty($results) ? static::mapDataToModel($results[0]) : null;
return !empty($results) ? static::mapDataToModel($results[0]) : null;

Check warning on line 212 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L212

Added line #L212 was not covered by tests

if (empty($results))
return [];
Expand All @@ -217,7 +220,7 @@ public static function findBy(array $conditions, bool $single = false): array|ob
// Fetch all soft deleted records
public static function findSoftDeleted(): array
{
if (! static::hasSoftDelete())
if (!static::hasSoftDelete())

Check warning on line 223 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L223

Added line #L223 was not covered by tests
return [];

$table = static::getTableName();
Expand All @@ -236,7 +239,7 @@ public function hasOne(string $relatedModel, string $foreignKey, string $localKe
$query = "SELECT * FROM $relatedTable WHERE $foreignKey = :localKeyValue LIMIT 1";
$results = Database::prepareAndExecute($query, ['localKeyValue' => $localKeyValue]);

return ! empty($results) ? $relatedModel::mapDataToModel($results[0]) : null;
return !empty($results) ? $relatedModel::mapDataToModel($results[0]) : null;

Check warning on line 242 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L242

Added line #L242 was not covered by tests
}

// One-to-Many relationship
Expand All @@ -249,7 +252,7 @@ public function hasMany(string $relatedModel, string $foreignKey, string $localK
$results = Database::prepareAndExecute($query, ['localKeyValue' => $localKeyValue]);

// Ensure $results is an array
if (! is_array($results))
if (!is_array($results))

Check warning on line 255 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L255

Added line #L255 was not covered by tests
$results = [];

return array_map(fn($row) => $relatedModel::mapDataToModel($row), $results);
Expand All @@ -261,10 +264,10 @@ protected static function hasSoftDelete(): bool
static $softDeleteCache = [];
$table = static::getTableName();

if (! isset($softDeleteCache[$table])) {
if (!isset($softDeleteCache[$table])) {

Check warning on line 267 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L267

Added line #L267 was not covered by tests
$query = "SHOW COLUMNS FROM {$table} LIKE 'deleted_at'";
$result = Database::prepareAndExecute($query);
$softDeleteCache[$table] = ! empty($result); // Cache the result
$softDeleteCache[$table] = !empty($result); // Cache the result

Check warning on line 270 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L270

Added line #L270 was not covered by tests
}

return $softDeleteCache[$table];
Expand All @@ -277,7 +280,7 @@ public static function paginate(int $page = 1, int $perPage = 10, array $conditi
$query = "SELECT * FROM " . static::getTableName();
$params = [];

if (! empty($conditions)) {
if (!empty($conditions)) {

Check warning on line 283 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L283

Added line #L283 was not covered by tests
$query .= " WHERE " . implode(' AND ', array_map(fn($key) => "{$key} = :{$key}", array_keys($conditions)));
$params = $conditions;
}
Expand Down Expand Up @@ -326,7 +329,7 @@ public function save(): void

Database::prepareAndExecute($query, $properties);

if (! isset($this->id))
if (!isset($this->id))

Check warning on line 332 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L332

Added line #L332 was not covered by tests
$this->id = Database::connect()->lastInsertId();
}

Expand All @@ -344,4 +347,14 @@ public function getCreatedAt(): ?string
{
return $this->created_at;
}

public function getUpdatedAt(): ?string

Check warning on line 351 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L351

Added line #L351 was not covered by tests
{
return $this->updated_at;

Check warning on line 353 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L353

Added line #L353 was not covered by tests
}

public function getDeletedAt(): ?string

Check warning on line 356 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L356

Added line #L356 was not covered by tests
{
return $this->deleted_at;

Check warning on line 358 in app/src/app/Models/BaseModel.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/BaseModel.php#L358

Added line #L358 was not covered by tests
}
}
2 changes: 2 additions & 0 deletions app/src/app/Models/Contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ protected static function mapDataToModel($data): Contract
$contract->invoice_agreed = $data['invoice_agreed'];
$contract->invoice_paid = $data['invoice_paid'];
$contract->created_at = $data['created_at'];
$contract->updated_at = $data['updated_at'];
$contract->deleted_at = $data['deleted_at'];

Check warning on line 36 in app/src/app/Models/Contract.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Contract.php#L35-L36

Added lines #L35 - L36 were not covered by tests

return $contract;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ protected static function mapDataToModel($data): Element
// $element->point_id = $data['point_id'];
$element->tree_type_id = $data['tree_type_id'];
$element->created_at = $data['created_at'];
$element->updated_at = $data['updated_at'];
$element->deleted_at = $data['deleted_at'];

Check warning on line 33 in app/src/app/Models/Element.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Element.php#L32-L33

Added lines #L32 - L33 were not covered by tests

return $element;
}
Expand Down
16 changes: 9 additions & 7 deletions app/src/app/Models/ElementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ protected static function getTableName(): string

protected static function mapDataToModel($data): ElementType

Check warning on line 16 in app/src/app/Models/ElementType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/ElementType.php#L16

Added line #L16 was not covered by tests
{
$elementType = new self();
$elementType->id = $data['id'];
$elementType->name = $data['name'];
$elementType->description = $data['description'];
$elementType->created_at = $data['created_at'];

return $elementType;
$element_type = new self();
$element_type->id = $data['id'];
$element_type->name = $data['name'];
$element_type->description = $data['description'];
$element_type->created_at = $data['created_at'];
$element_type->updated_at = $data['updated_at'];
$element_type->deleted_at = $data['deleted_at'];

Check warning on line 24 in app/src/app/Models/ElementType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/ElementType.php#L18-L24

Added lines #L18 - L24 were not covered by tests

return $element_type;

Check warning on line 26 in app/src/app/Models/ElementType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/ElementType.php#L26

Added line #L26 was not covered by tests
}

//public function element(): Element
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Incidence.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public static function mapDataToModel($data): Incidence
$incidence->description = $data['description'];
$incidence->photo_id = $data['photo_id'];
$incidence->created_at = $data['created_at'];
$incidence->updated_at = $data['updated_at'];
$incidence->deleted_at = $data['deleted_at'];

Check warning on line 30 in app/src/app/Models/Incidence.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Incidence.php#L29-L30

Added lines #L29 - L30 were not covered by tests

return $incidence;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ protected static function mapDataToModel($data): Machine
$machine->max_basket_size = $data['max_basket_size'];
$machine->photo_id = $data['photo_id'];
$machine->created_at = $data['created_at'];
$machine->updated_at = $data['updated_at'];
$machine->deleted_at = $data['deleted_at'];

Check warning on line 27 in app/src/app/Models/Machine.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Machine.php#L26-L27

Added lines #L26 - L27 were not covered by tests

return $machine;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ protected static function mapDataToModel($data): Photo
$photo->name = $data['name'];
$photo->path = $data['path'];
$photo->created_at = $data['created_at'];
$photo->updated_at = $data['updated_at'];
$photo->deleted_at = $data['deleted_at'];

Check warning on line 24 in app/src/app/Models/Photo.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Photo.php#L23-L24

Added lines #L23 - L24 were not covered by tests

return $photo;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ protected static function mapDataToModel($data): Point
$point->latitude = $data['latitude'];
$point->longitude = $data['longitude'];
$point->created_at = $data['created_at'];
$point->updated_at = $data['updated_at'];
$point->deleted_at = $data['deleted_at'];

Check warning on line 24 in app/src/app/Models/Point.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Point.php#L23-L24

Added lines #L23 - L24 were not covered by tests

return $point;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/PruningType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ protected static function mapDataToModel($data): PruningType
$pruning_type->description = $data['description'];
$pruning_type->photo_id = $data['photo_id'];
$pruning_type->created_at = $data['created_at'];
$pruning_type->updated_at = $data['updated_at'];
$pruning_type->deleted_at = $data['deleted_at'];

Check warning on line 27 in app/src/app/Models/PruningType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/PruningType.php#L26-L27

Added lines #L26 - L27 were not covered by tests

return $pruning_type;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ protected static function mapDataToModel($data): Role
$role->id = $data['id'];
$role->name = $data['name'];
$role->created_at = $data['created_at'];
$role->updated_at = $data['updated_at'];
$role->deleted_at = $data['deleted_at'];

Check warning on line 21 in app/src/app/Models/Role.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Role.php#L20-L21

Added lines #L20 - L21 were not covered by tests

return $role;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ protected static function mapDataToModel($data): Route
$route->distance = $data['distance'];
$route->travel_time = $data['travel_time'];
$route->created_at = $data['created_at'];
$route->updated_at = $data['updated_at'];
$route->deleted_at = $data['deleted_at'];

Check warning on line 24 in app/src/app/Models/Route.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Route.php#L23-L24

Added lines #L23 - L24 were not covered by tests

return $route;
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/app/Models/Sensor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ protected static function mapDataToModel($data): Sensor
$sensor->model = $data["model"];
$sensor->class = $data["class"];
$sensor->is_active = $data["is_active"];
$sensor->created_at = $data["created_at"];
$sensor->created_at = $data['created_at'];
$sensor->updated_at = $data['updated_at'];
$sensor->deleted_at = $data['deleted_at'];

Check warning on line 26 in app/src/app/Models/Sensor.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Sensor.php#L24-L26

Added lines #L24 - L26 were not covered by tests

return $sensor;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/SensorHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ protected static function mapDataToModel($data): SensorHistory
$sensor_history->humidity = $data['humidity'];
$sensor_history->inclination = $data['inclination'];
$sensor_history->created_at = $data['created_at'];
$sensor_history->updated_at = $data['updated_at'];
$sensor_history->deleted_at = $data['deleted_at'];

Check warning on line 26 in app/src/app/Models/SensorHistory.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/SensorHistory.php#L25-L26

Added lines #L25 - L26 were not covered by tests

return $sensor_history;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ protected static function mapDataToModel($data): Task
$task->notes = $data['notes'];
$task->route_id = $data['route_id'];
$task->created_at = $data['created_at'];
$task->updated_at = $data['updated_at'];
$task->deleted_at = $data['deleted_at'];

Check warning on line 30 in app/src/app/Models/Task.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Task.php#L29-L30

Added lines #L29 - L30 were not covered by tests

return $task;
}
Expand Down
14 changes: 8 additions & 6 deletions app/src/app/Models/TaskType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ protected static function getTableName(): string

protected static function mapDataToModel($data): TaskType
{
$task = new self();
$task->id = $data['id'];
$task->name = $data['name'];
$task->photo_id = $data['photo_id'];
$task->created_at = $data['created_at'];
$task_type = new self();
$task_type->id = $data['id'];
$task_type->name = $data['name'];
$task_type->photo_id = $data['photo_id'];
$task_type->created_at = $data['created_at'];
$task_type->updated_at = $data['updated_at'];
$task_type->deleted_at = $data['deleted_at'];

Check warning on line 24 in app/src/app/Models/TaskType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/TaskType.php#L18-L24

Added lines #L18 - L24 were not covered by tests

return $task;
return $task_type;

Check warning on line 26 in app/src/app/Models/TaskType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/TaskType.php#L26

Added line #L26 was not covered by tests
}

public function photo(): ?Photo
Expand Down
3 changes: 3 additions & 0 deletions app/src/app/Models/TreeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ protected static function mapDataToModel($data): TreeType
$tree_type->family = $data['family'];
$tree_type->genus = $data['genus'];
$tree_type->species = $data['species'];
$tree_type->created_at = $data['created_at'];
$tree_type->updated_at = $data['updated_at'];
$tree_type->deleted_at = $data['deleted_at'];

Check warning on line 27 in app/src/app/Models/TreeType.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/TreeType.php#L25-L27

Added lines #L25 - L27 were not covered by tests

return $tree_type;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ protected static function mapDataToModel($data): User
$user->role = $data['role'];
$user->photo_id = $data['photo_id'];
$user->created_at = $data['created_at'];
$user->updated_at = $data['updated_at'];
$user->deleted_at = $data['deleted_at'];

Check warning on line 47 in app/src/app/Models/User.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/User.php#L46-L47

Added lines #L46 - L47 were not covered by tests

return $user;
}
Expand Down
14 changes: 8 additions & 6 deletions app/src/app/Models/WorkOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ protected static function getTableName(): string

protected static function mapDataToModel($data): WorkOrder
{
$order = new self();
$order->id = $data['id'];
$order->contract_id = $data['contract_id'];
$order->created_at = $data['created_at'];

return $order;
$work_order = new self();
$work_order->id = $data['id'];
$work_order->contract_id = $data['contract_id'];
$work_order->created_at = $data['created_at'];
$work_order->updated_at = $data['updated_at'];
$work_order->deleted_at = $data['deleted_at'];

Check warning on line 21 in app/src/app/Models/WorkOrder.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/WorkOrder.php#L16-L21

Added lines #L16 - L21 were not covered by tests

return $work_order;

Check warning on line 23 in app/src/app/Models/WorkOrder.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/WorkOrder.php#L23

Added line #L23 was not covered by tests
}

public function report(): WorkReport
Expand Down
18 changes: 10 additions & 8 deletions app/src/app/Models/WorkReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ protected static function getTableName(): string

protected static function mapDataToModel($data): WorkReport
{
$workReport = new self();
$workReport->id = $data['id'];
$workReport->work_order_id = $data['work_order_id'];
$workReport->observation = $data['observation'];
$workReport->spent_fuel = $data['spent_fuel'];
$workReport->created_at = $data['created_at'];

return $workReport;
$work_report = new self();
$work_report->id = $data['id'];
$work_report->work_order_id = $data['work_order_id'];
$work_report->observation = $data['observation'];
$work_report->spent_fuel = $data['spent_fuel'];
$work_report->created_at = $data['created_at'];
$work_report->updated_at = $data['updated_at'];
$work_report->deleted_at = $data['deleted_at'];

Check warning on line 27 in app/src/app/Models/WorkReport.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/WorkReport.php#L20-L27

Added lines #L20 - L27 were not covered by tests

return $work_report;

Check warning on line 29 in app/src/app/Models/WorkReport.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/WorkReport.php#L29

Added line #L29 was not covered by tests
}

public function workOrder(): WorkOrder
Expand Down
4 changes: 4 additions & 0 deletions app/src/app/Models/Zone.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ protected static function mapDataToModel($data): Zone
$zone->id = $data['id'];
$zone->point_id = $data['point_id'];
$zone->created_at = $data['created_at'];
$zone->updated_at = $data['updated_at'];
$zone->deleted_at = $data['deleted_at'];

Check warning on line 25 in app/src/app/Models/Zone.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Zone.php#L24-L25

Added lines #L24 - L25 were not covered by tests

return $zone;
}
Expand Down Expand Up @@ -75,6 +77,8 @@ public static function getPredefinedZonesWithElements(): array
$zone->predefined->name = $row['predefined_name'];
$zone->predefined->photo_id = $row['predefined_photo_id'];
$zone->predefined->created_at = $row['created_at'];
$zone->predefined->updated_at = $row['updated_at'];
$zone->predefined->deleted_at = $row['deleted_at'];

Check warning on line 81 in app/src/app/Models/Zone.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Models/Zone.php#L80-L81

Added lines #L80 - L81 were not covered by tests

$groupedZones[$row['id']] = $zone;
}
Expand Down
Loading

0 comments on commit 5128e76

Please sign in to comment.