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

Support doctrine/orm 3 #63

Closed
wants to merge 1 commit into from
Closed
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: 2 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

// Debug only
set_time_limit(0);

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

"require": {
"php": "^8.2",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/data-fixtures": "^1.5",
"doctrine/orm": "^2.10.0",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/data-fixtures": "^1.7",
"doctrine/orm": "^2.19 || ^3",
"doctrine/persistence": "^2.2 || ^3.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/finder": "^6.4 || ^7.0",
Expand Down
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
25 changes: 10 additions & 15 deletions fixtures/Persistence/FakeDoctrineManagerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,57 +26,52 @@ public function getDefaultConnectionName(): string
$this->__call(__METHOD__, func_get_args());
}

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

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

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

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

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

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

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

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

public function getManagerNames()
public function getRepository($persistentObject, $persistentManagerName = null): void
{
$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($class): void
{
$this->__call(__METHOD__, func_get_args());
}
Expand Down
105 changes: 49 additions & 56 deletions fixtures/Persistence/ObjectMapper/FakeEntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,211 +13,204 @@

namespace Hautelook\AliceBundle\Persistence\ObjectMapper;

use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\Cache;
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\ResultSetMapping;
use Doctrine\ORM\QueryBuilder;
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 wrapInTransaction($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 createNativeQuery($sql, ResultSetMapping $rsm): NativeQuery
{
$this->__call(__METHOD__, func_get_args());
}

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

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

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

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

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

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

public function copy($entity, $deep = false)
public function getConfiguration(): \Doctrine\ORM\Configuration
{
$this->__call(__METHOD__, func_get_args());
}

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

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

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

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

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

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

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

public function getProxyFactory()
public function find($className, $id, LockMode|int|null $lockMode = null, int|null $lockVersion = null): ?object
{
$this->__call(__METHOD__, func_get_args());
}

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

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

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

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

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

public function remove($object)
public function refresh($object, LockMode|int|null $lockMode = null): void
{
$this->__call(__METHOD__, func_get_args());
}

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

public function clear($objectName = null)
public function getRepository($className): EntityRepository
{
$this->__call(__METHOD__, func_get_args());
}

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

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

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

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

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

public function initializeObject($obj)
{
$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
1 change: 0 additions & 1 deletion src/PhpUnit/RefreshDatabaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ protected static function bootKernel(array $options = []): KernelInterface
->get('doctrine')
->getConnection(FixtureStore::getConnectionName());

$connection->setNestTransactionsWithSavepoints(true);
$connection->beginTransaction();

return $kernel;
Expand Down
Loading