<?php

namespace Doctrine\ORM;

use Doctrine\ORM\Exception\ORMException;

class EntityManager implements EntityManagerInterface
{

	/**
	 * @template T of object
	 * @phpstan-param class-string<T> $entityName
	 * @phpstan-param mixed  $id
	 * @phpstan-param integer|null $lockMode
	 * @phpstan-param integer|null $lockVersion
	 * @phpstan-return T|null
	 * @phpstan-impure
	 */
	public function find($entityName, $id, $lockMode = null, $lockVersion = null);

	/**
	 * @template T of object
	 * @phpstan-param T $entity
	 * @phpstan-return T
	 * @deprecated 2.7 This method is being removed from the ORM and won't have any replacement
	 */
	public function merge($entity);

	/**
	 * @template T of object
	 * @phpstan-param class-string<T> $entityName
	 * @phpstan-return EntityRepository<T>
	 */
	public function getRepository($entityName);

	/**
	 * @template T of object
	 * @phpstan-param class-string<T> $entityName
	 * @phpstan-param mixed $id
	 * @phpstan-return T|null
	 *
	 * @throws ORMException
	 */
	public function getReference($entityName, $id);

	/**
	 * @template T of object
	 * @phpstan-param class-string<T> $entityName
	 * @phpstan-param mixed $identifier
	 *
	 * @phpstan-return T|null
	 */
	public function getPartialReference($entityName, $identifier);

	/**
	 * @template T of object
	 * @phpstan-param T $entity
	 * @phpstan-param bool $deep
	 * @phpstan-return T
	 * @deprecated 2.7 This method is being removed from the ORM and won't have any replacement
	 */
	public function copy($entity, $deep = false);

	/**
     * @param object|object[]|null $entity
     * @return void
     *
     * @throws ORMException
     * @throws \Doctrine\DBAL\Exception\UniqueConstraintViolationException
     */
    public function flush($entity = null);

}
