[CORE][DB] DB:removeBy Accept class name instead of table.

This commit is contained in:
Diogo Peralta Cordeiro 2022-01-02 23:47:19 +00:00
parent b7574500f8
commit d27e8610d6
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0

View File

@ -269,7 +269,7 @@ class DB
public static function removeBy(string $table, array $criteria): void
{
$class = self::$table_map[$table];
$class = self::$table_map[$table] ?? $table; // We're often already given the class's name
if (empty(array_intersect(self::getPKForClass($class), array_keys($criteria)))) {
self::remove(self::findOneBy($class, $criteria));
} else {