[CORE][DB] Document magic methods

This commit is contained in:
Diogo Peralta Cordeiro 2021-11-26 15:11:30 +00:00
parent d46a6163a0
commit 0ab8febab3
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0

View File

@ -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<string, mixed> $values)
* @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.
*/
class DB
{