From 0ab8febab300b279a31da85ce386e066ed496406 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Fri, 26 Nov 2021 15:11:30 +0000 Subject: [PATCH] [CORE][DB] Document magic methods --- src/Core/DB/DB.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Core/DB/DB.php b/src/Core/DB/DB.php index cd000f7200..119ff60301 100644 --- a/src/Core/DB/DB.php +++ b/src/Core/DB/DB.php @@ -37,8 +37,8 @@ namespace App\Core\DB; use App\Util\Exception\DuplicateFoundException; use App\Util\Exception\NotFoundException; use Doctrine\Common\Collections\Criteria; -use Doctrine\Common\Collections\Expr\Expression; use Doctrine\Common\Collections\ExpressionBuilder; +use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; @@ -47,10 +47,16 @@ use Exception; use Functional as F; /** - * @mixin EntityManagerInterface + * @mixin EntityManager * @template T * - * @method T find(string $class, array $values) + * @method static T find(string $class, array $values) // Finds an Entity by its identifier. + * @method static T getReference(string $class, array $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. */ class DB {