CodeExplorer quoteFields example
$result->items =
$items;
return $result;
} public function save(array
$data, ?int
$id = null
): int
{ $this->
validateFields($data);
$data =
$this->
filterFields($data);
$data =
$this->
quoteFields($data);
$data['updated_at'
] =
date('Y-m-d H:i:s'
);
if ($id) { $this->connection->
update($this->type->
getTableName(),
$data,
['id' =>
$id]);
} else { $data['created_at'
] =
date('Y-m-d H:i:s'
);
$this->connection->
insert($this->type->
getTableName(),
$data);
$id =
(int) $this->connection->
lastInsertId();
} return $id;
}