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

refactor: Update the signatures of the doctrine related classes #66

Merged
merged 6 commits into from
Mar 8, 2024
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
2 changes: 1 addition & 1 deletion fixtures/Functional/TestBundle/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Product
#[ORM\Column(type: 'string', length: 100)]
protected $name;

#[ORM\Column(type: 'decimal', scale: 2)]
#[ORM\Column(type: 'decimal', precision: 10, scale: 2)]
protected $price;

#[ORM\Column(type: 'text')]
Expand Down
26 changes: 11 additions & 15 deletions fixtures/Persistence/FakeDoctrineManagerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Hautelook\AliceBundle\Persistence;

use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\ObjectManager;
use function func_get_args;
use Hautelook\AliceBundle\NotCallableTrait;

Expand All @@ -26,57 +27,52 @@ public function getDefaultConnectionName(): string
$this->__call(__METHOD__, func_get_args());
}

public function getConnection($name = null)
public function getConnection(?string $name = null): object
{
$this->__call(__METHOD__, func_get_args());
}

public function getConnections()
public function getConnections(): array
{
$this->__call(__METHOD__, func_get_args());
}

public function getConnectionNames()
public function getConnectionNames(): array
{
$this->__call(__METHOD__, func_get_args());
}

public function getDefaultManagerName()
public function getDefaultManagerName(): string
{
$this->__call(__METHOD__, func_get_args());
}

public function getManager($name = null)
public function getManager(?string $name = null): ObjectManager
{
$this->__call(__METHOD__, func_get_args());
}

public function getManagers()
public function getManagers(): array
{
$this->__call(__METHOD__, func_get_args());
}

public function resetManager($name = null)
public function resetManager(?string $name = null): ObjectManager
{
$this->__call(__METHOD__, func_get_args());
}

public function getAliasNamespace($alias)
public function getManagerNames(): array
{
$this->__call(__METHOD__, func_get_args());
}

public function getManagerNames()
public function getRepository(string $persistentObject, ?string $persistentManagerName = null)
{
$this->__call(__METHOD__, func_get_args());
}

public function getRepository($persistentObject, $persistentManagerName = null)
{
$this->__call(__METHOD__, func_get_args());
}

public function getManagerForClass($class)
public function getManagerForClass(string $class): ?ObjectManager
{
$this->__call(__METHOD__, func_get_args());
}
Expand Down
98 changes: 54 additions & 44 deletions fixtures/Persistence/ObjectMapper/FakeEntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,211 +13,221 @@

namespace Hautelook\AliceBundle\Persistence\ObjectMapper;

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\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\ObjectRepository;
use function func_get_args;
use Hautelook\AliceBundle\NotCallableTrait;

class FakeEntityManager implements EntityManagerInterface
{
use NotCallableTrait;

public function getCache()
public function getCache(): ?Cache
{
$this->__call(__METHOD__, func_get_args());
}

public function getConnection()
public function getConnection(): Connection
{
$this->__call(__METHOD__, func_get_args());
}

public function getExpressionBuilder()
public function getExpressionBuilder(): Expr
{
$this->__call(__METHOD__, func_get_args());
}

public function beginTransaction()
public function beginTransaction(): void
{
$this->__call(__METHOD__, func_get_args());
}

public function transactional($func)
public function transactional($func): mixed
{
$this->__call(__METHOD__, func_get_args());
}

public function commit()
public function commit(): void
{
$this->__call(__METHOD__, func_get_args());
}

public function rollback()
public function rollback(): void
{
$this->__call(__METHOD__, func_get_args());
}

public function createQuery($dql = '')
public function createQuery($dql = ''): Query
{
$this->__call(__METHOD__, func_get_args());
}

public function createNamedQuery($name)
public function createNamedQuery($name): Query
{
$this->__call(__METHOD__, func_get_args());
}

public function createNativeQuery($sql, ResultSetMapping $rsm)
public function createNativeQuery($sql, ResultSetMapping $rsm): NativeQuery
{
$this->__call(__METHOD__, func_get_args());
}

public function createNamedNativeQuery($name)
public function createNamedNativeQuery($name): NativeQuery
{
$this->__call(__METHOD__, func_get_args());
}

public function createQueryBuilder()
public function createQueryBuilder(): QueryBuilder
{
$this->__call(__METHOD__, func_get_args());
}

public function getReference($entityName, $id)
public function getReference($entityName, $id): ?object
{
$this->__call(__METHOD__, func_get_args());
}

public function getPartialReference($entityName, $identifier)
public function getPartialReference($entityName, $identifier): ?object
{
$this->__call(__METHOD__, func_get_args());
}

public function close()
public function close(): void
{
$this->__call(__METHOD__, func_get_args());
}

public function copy($entity, $deep = false)
public function copy($entity, $deep = false): object
{
$this->__call(__METHOD__, func_get_args());
}

public function lock($entity, $lockMode, $lockVersion = null)
public function lock($entity, $lockMode, $lockVersion = null): void
{
$this->__call(__METHOD__, func_get_args());
}

public function getEventManager()
public function getEventManager(): EventManager
{
$this->__call(__METHOD__, func_get_args());
}

public function getConfiguration()
public function getConfiguration(): Configuration
{
$this->__call(__METHOD__, func_get_args());
}

public function isOpen()
public function isOpen(): bool
{
$this->__call(__METHOD__, func_get_args());
}

public function getUnitOfWork()
public function getUnitOfWork(): UnitOfWork
{
$this->__call(__METHOD__, func_get_args());
}

public function getHydrator($hydrationMode)
public function getHydrator($hydrationMode): AbstractHydrator
{
$this->__call(__METHOD__, func_get_args());
}

public function newHydrator($hydrationMode)
public function newHydrator($hydrationMode): AbstractHydrator
{
$this->__call(__METHOD__, func_get_args());
}

public function getProxyFactory()
public function getProxyFactory(): ProxyFactory
{
$this->__call(__METHOD__, func_get_args());
}

public function getFilters()
public function getFilters(): FilterCollection
{
$this->__call(__METHOD__, func_get_args());
}

public function isFiltersStateClean()
public function isFiltersStateClean(): bool
{
$this->__call(__METHOD__, func_get_args());
}

public function hasFilters()
public function hasFilters(): bool
{
$this->__call(__METHOD__, func_get_args());
}

public function find($className, $id)
public function find(string $className, $id): ?object
{
$this->__call(__METHOD__, func_get_args());
}

public function persist($object)
public function persist(object $object): void
{
$this->__call(__METHOD__, func_get_args());
}

public function remove($object)
public function remove(object $object): void
{
$this->__call(__METHOD__, func_get_args());
}

public function merge($object)
public function clear($objectName = null): void
{
$this->__call(__METHOD__, func_get_args());
}

public function clear($objectName = null)
public function detach(object $object): void
{
$this->__call(__METHOD__, func_get_args());
}

public function detach($object)
public function refresh(object $object): void
{
$this->__call(__METHOD__, func_get_args());
}

public function refresh($object)
public function flush(): void
{
$this->__call(__METHOD__, func_get_args());
}

public function flush()
public function getRepository($className): EntityRepository
{
$this->__call(__METHOD__, func_get_args());
}

public function getRepository($className)
public function getMetadataFactory(): ObjectRepository
{
$this->__call(__METHOD__, func_get_args());
}

public function getMetadataFactory()
public function initializeObject(object $obj): void
{
$this->__call(__METHOD__, func_get_args());
}

public function initializeObject($obj)
public function contains(object $object): bool
{
$this->__call(__METHOD__, func_get_args());
}

public function contains($object)
{
$this->__call(__METHOD__, func_get_args());
}

public function getClassMetadata($className)
public function getClassMetadata($className): ClassMetadata
{
$this->__call(__METHOD__, func_get_args());
}
Expand Down
Loading