Skip to content

Commit 84cbea7

Browse files
authored
Update Orm.php
1 parent 344ff1b commit 84cbea7

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/Orm.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class Orm
66
{
77
/**
8-
* @param array<string, ?string> $object
8+
* @param array<string, string|float|int|null> $object
99
*/
1010
public static function insert(string $tableName, array $object): int
1111
{
@@ -27,7 +27,7 @@ public static function insert(string $tableName, array $object): int
2727
}
2828

2929
/**
30-
* @param array<string, ?string> $object
30+
* @param array<string, string|float|int|null> $object
3131
*/
3232
public static function update(string $tableName, array $object, string|int $id, string $idField = 'id'): int
3333
{
@@ -56,11 +56,17 @@ public static function update(string $tableName, array $object, string|int $id,
5656
}
5757

5858
/**
59-
* @return array<string, ?string> $object
59+
* @return array<string, string|float|int|null>
6060
*/
6161
public static function select(string $tableName, string|int $id, string $idField = 'id'): array
6262
{
6363
$sql = "SELECT * FROM `$tableName` WHERE `$idField` = ?";
6464
return DB::selectOne($sql, [$id])[$tableName] ?? [];
6565
}
66+
67+
public static function delete(string $tableName, string|int $id, string $idField = 'id'): int
68+
{
69+
$sql = "DELETE FROM `$tableName` WHERE `$idField` = ?";
70+
return DB::delete($sql, [$id]);
71+
}
6672
}

0 commit comments

Comments
 (0)