From 197d8d5a9569050787f9fda7f114f405604057a0 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 22:26:15 +0000 Subject: [PATCH] style: Format code with php-cs-fixer --- deploy/lib/data/NWQuery.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/deploy/lib/data/NWQuery.php b/deploy/lib/data/NWQuery.php index 19d5249e8..c7ea78fcc 100644 --- a/deploy/lib/data/NWQuery.php +++ b/deploy/lib/data/NWQuery.php @@ -9,17 +9,15 @@ use PDOStatement; /** - * Acts as a mini model and query builder with an ActiveRecord pattern + * Acts as a mini model and query builder with an ActiveRecord pattern * (e.g. Message::find(id) $message->save(), whatever nw needs) */ abstract class NWQuery { - protected $date; + // Inheriting classes need to set primaryKey and table as: + // protected $primaryKey; + // protected $table = 'messages'; - public function __construct() - { - $this->date = static::freshTimestamp(); - } public static function freshTimestamp() { @@ -79,7 +77,6 @@ public static function find(int|null|string $id) { $model = new static(); $found_data = reset(self::query(['select * from messages where ' . $model->primaryKey . ' = :id', [':id' => $id]])); - $model = new static(); foreach ($found_data as $key => $value) { $model->$key = $value; } @@ -88,5 +85,4 @@ public static function find(int|null|string $id) abstract protected function save(); abstract protected function delete(); - }