Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types to entity manager #9292

Merged
merged 1 commit into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 56 additions & 91 deletions lib/Doctrine/ORM/Decorator/EntityManagerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@

namespace Doctrine\ORM\Decorator;

use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Cache;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\NativeQuery;
use Doctrine\ORM\Proxy\ProxyFactory;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\Query\FilterCollection;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\UnitOfWork;
use Doctrine\Persistence\ObjectManagerDecorator;

/**
Expand All @@ -21,26 +36,35 @@ public function __construct(EntityManagerInterface $wrapped)
$this->wrapped = $wrapped;
}

public function getRepository($className): EntityRepository
{
return parent::getRepository($className);
}

public function getMetadataFactory(): ClassMetadataFactory
{
return parent::getMetadataFactory();
}

/**
* {@inheritdoc}
*/
public function getConnection()
public function getClassMetadata($className): ClassMetadata
{
return parent::getClassMetadata($className);
}

public function getConnection(): Connection
{
return $this->wrapped->getConnection();
}

/**
* {@inheritdoc}
*/
public function getExpressionBuilder()
public function getExpressionBuilder(): Expr
{
return $this->wrapped->getExpressionBuilder();
}

/**
* {@inheritdoc}
*/
public function beginTransaction()
public function beginTransaction(): void
{
$this->wrapped->beginTransaction();
}
Expand All @@ -53,194 +77,135 @@ public function wrapInTransaction(callable $func)
return $this->wrapped->wrapInTransaction($func);
}

/**
* {@inheritdoc}
*/
public function commit()
public function commit(): void
{
$this->wrapped->commit();
}

/**
* {@inheritdoc}
*/
public function rollback()
public function rollback(): void
{
$this->wrapped->rollback();
}

/**
* {@inheritdoc}
*/
public function createQuery($dql = '')
public function createQuery(string $dql = ''): Query
{
return $this->wrapped->createQuery($dql);
}

/**
* {@inheritdoc}
*/
public function createNamedQuery($name)
public function createNamedQuery(string $name): Query
{
return $this->wrapped->createNamedQuery($name);
}

/**
* {@inheritdoc}
*/
public function createNativeQuery($sql, ResultSetMapping $rsm)
public function createNativeQuery(string $sql, ResultSetMapping $rsm): NativeQuery
{
return $this->wrapped->createNativeQuery($sql, $rsm);
}

/**
* {@inheritdoc}
*/
public function createNamedNativeQuery($name)
public function createNamedNativeQuery(string $name): NativeQuery
{
return $this->wrapped->createNamedNativeQuery($name);
}

/**
* {@inheritdoc}
*/
public function createQueryBuilder()
public function createQueryBuilder(): QueryBuilder
{
return $this->wrapped->createQueryBuilder();
}

/**
* {@inheritdoc}
*/
public function getReference($entityName, $id)
public function getReference(string $entityName, $id): ?object
{
return $this->wrapped->getReference($entityName, $id);
}

/**
* {@inheritdoc}
*/
public function getPartialReference($entityName, $identifier)
public function getPartialReference(string $entityName, $identifier): ?object
{
return $this->wrapped->getPartialReference($entityName, $identifier);
}

/**
* {@inheritdoc}
*/
public function close()
public function close(): void
{
$this->wrapped->close();
}

/**
* {@inheritdoc}
*/
public function lock($entity, $lockMode, $lockVersion = null)
public function lock(object $entity, int $lockMode, $lockVersion = null): void
{
$this->wrapped->lock($entity, $lockMode, $lockVersion);
}

/**
* {@inheritdoc}
*/
public function find($className, $id, $lockMode = null, $lockVersion = null)
public function find($className, mixed $id, ?int $lockMode = null, ?int $lockVersion = null): ?object
{
return $this->wrapped->find($className, $id, $lockMode, $lockVersion);
}

/**
* {@inheritdoc}
*/
public function flush($entity = null)
public function flush($entity = null): void
{
$this->wrapped->flush($entity);
}

/**
* {@inheritdoc}
*/
public function getEventManager()
public function getEventManager(): EventManager
{
return $this->wrapped->getEventManager();
}

/**
* {@inheritdoc}
*/
public function getConfiguration()
public function getConfiguration(): Configuration
{
return $this->wrapped->getConfiguration();
}

/**
* {@inheritdoc}
*/
public function isOpen()
public function isOpen(): bool
{
return $this->wrapped->isOpen();
}

/**
* {@inheritdoc}
*/
public function getUnitOfWork()
public function getUnitOfWork(): UnitOfWork
{
return $this->wrapped->getUnitOfWork();
}

/**
* {@inheritdoc}
*/
public function getHydrator($hydrationMode)
{
return $this->wrapped->getHydrator($hydrationMode);
}

/**
* {@inheritdoc}
*/
public function newHydrator($hydrationMode)
public function newHydrator($hydrationMode): AbstractHydrator
{
return $this->wrapped->newHydrator($hydrationMode);
}

/**
* {@inheritdoc}
*/
public function getProxyFactory()
public function getProxyFactory(): ProxyFactory
{
return $this->wrapped->getProxyFactory();
}

/**
* {@inheritdoc}
*/
public function getFilters()
public function getFilters(): FilterCollection
{
return $this->wrapped->getFilters();
}

/**
* {@inheritdoc}
*/
public function isFiltersStateClean()
public function isFiltersStateClean(): bool
{
return $this->wrapped->isFiltersStateClean();
}

/**
* {@inheritdoc}
*/
public function hasFilters()
public function hasFilters(): bool
{
return $this->wrapped->hasFilters();
}

/**
* {@inheritdoc}
*/
public function getCache()
public function getCache(): ?Cache
{
return $this->wrapped->getCache();
}
Expand Down
Loading