[CORE][DB][ENTITY][Actor] Add DB::removeBy and use it in Actor->setSelfTags

This commit is contained in:
2021-11-28 12:13:30 +00:00
committed by Diogo Peralta Cordeiro
parent 66ff3c594d
commit fc81f7301c
2 changed files with 12 additions and 8 deletions

View File

@@ -50,13 +50,13 @@ use Functional as F;
* @mixin EntityManager
* @template T
*
* @method static T find(string $class, array<string, mixed> $values) // Finds an Entity by its identifier.
* @method static T find(string $class, array<string, mixed> $values) // Finds an Entity by its identifier.
* @method static T getReference(string $class, array<string, mixed> $values) // Special cases: It's like find but does not load the object if it has not been loaded yet, it only returns a proxy to the object. (https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/unitofwork.html)
* @method static void remove(object $entity) // Removes an entity instance.
* @method static T merge(object $entity) // Merges the state of a detached entity into the persistence context
* @method static void persist(object $entity) // Tells the EntityManager to make an instance managed and persistent.
* @method static bool contains(object $entity) // Determines whether an entity instance is managed in this EntityManager.
* @method static void flush() // Flushes the in-memory state of persisted objects to the database.
* @method static void remove(object $entity) // Removes an entity instance.
* @method static T merge(object $entity) // Merges the state of a detached entity into the persistence context
* @method static void persist(object $entity) // Tells the EntityManager to make an instance managed and persistent.
* @method static bool contains(object $entity) // Determines whether an entity instance is managed in this EntityManager.
* @method static void flush() // Flushes the in-memory state of persisted objects to the database.
*/
class DB
{
@@ -224,6 +224,11 @@ class DB
}
}
public static function removeBy(string $table, array $criteria)
{
self::remove(self::getReference($table, $criteria));
}
public static function count(string $table, array $criteria)
{
/** @var EntityRepository */