Skip to content

Commit

Permalink
Fix deprecations when running against ODM 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Sep 30, 2019
1 parent 46e07b1 commit a60a072
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
- DRIVER_VERSION="stable"
- ADAPTER_VERSION="^1.0.0"
- COMPOSER_FLAGS="--prefer-dist"
- SYMFONY_DEPRECATIONS_HELPER="max[self]=0"

matrix:
include:
Expand Down
2 changes: 1 addition & 1 deletion Repository/ContainerRepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function getOrCreateRepository(DocumentManager $documentManager, ClassMe
return $this->managedRepositories[$repositoryHash];
}

$repositoryClassName = $metadata->customRepositoryClassName ?: $documentManager->getConfiguration()->getDefaultRepositoryClassName();
$repositoryClassName = $metadata->customRepositoryClassName ?: (method_exists($documentManager->getConfiguration(), 'getDefaultDocumentRepositoryClassName') ? $documentManager->getConfiguration()->getDefaultDocumentRepositoryClassName() : $documentManager->getConfiguration()->getDefaultRepositoryClassName());

return $this->managedRepositories[$repositoryHash] = new $repositoryClassName($documentManager, $documentManager->getUnitOfWork(), $metadata);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/Fixtures/config/yml/full.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
doctrine_mongodb:
fixture_loader: Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader
auto_generate_proxy_classes: true
auto_generate_proxy_classes: 2
auto_generate_hydrator_classes: true
auto_generate_persistent_collection_classes: 3
default_connection: conn1
Expand Down
3 changes: 3 additions & 0 deletions Tests/Mapping/Driver/YamlDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

use Doctrine\Bundle\MongoDBBundle\Mapping\Driver\YamlDriver;

/**
* @group legacy
*/
class YamlDriverTest extends AbstractDriverTest
{
protected function getFileExtension()
Expand Down
3 changes: 2 additions & 1 deletion Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Doctrine\Bundle\MongoDBBundle\Tests;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Proxy\AbstractProxyFactory;
use Doctrine\MongoDB\Connection;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
Expand All @@ -17,7 +18,7 @@ class TestCase extends BaseTestCase
public static function createTestDocumentManager($paths = [])
{
$config = new \Doctrine\ODM\MongoDB\Configuration();
$config->setAutoGenerateProxyClasses(true);
$config->setAutoGenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
$config->setProxyDir(\sys_get_temp_dir());
$config->setHydratorDir(\sys_get_temp_dir());
$config->setProxyNamespace('SymfonyTests\Doctrine');
Expand Down

0 comments on commit a60a072

Please sign in to comment.