Skip to content

Commit

Permalink
Add types to entity manager
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Dec 27, 2021
1 parent 9c07649 commit a0f7d27
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 626 deletions.
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, $id, $lockMode = null, $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

0 comments on commit a0f7d27

Please sign in to comment.