Skip to content

Commit

Permalink
Merge pull request #333 from greg0ire/address-persistence-deprecations
Browse files Browse the repository at this point in the history
Address deprecations from persistence
  • Loading branch information
greg0ire authored Jan 4, 2020
2 parents 608a35a + b7532e4 commit 89594f4
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 19 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ by implementing the [`Doctrine\Common\DataFixtures\FixtureInterface`](lib/Doctri
```php
namespace MyDataFixtures;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Persistence\ObjectManager;

class UserFixtureLoader implements FixtureInterface
{
Expand Down Expand Up @@ -82,7 +82,7 @@ a relation. Here is an example fixtures for **Role** and **User** relation
namespace MyDataFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

class UserRoleDataLoader extends AbstractFixture
{
Expand Down Expand Up @@ -110,7 +110,7 @@ And the **User** data loading fixture:
namespace MyDataFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

class UserDataLoader extends AbstractFixture
{
Expand Down Expand Up @@ -145,7 +145,7 @@ namespace MyDataFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

class MyFixture extends AbstractFixture implements OrderedFixtureInterface
{
Expand All @@ -168,7 +168,7 @@ namespace MyDataFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

class MyFixture extends AbstractFixture implements DependentFixtureInterface
{
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
],
"require": {
"php": "^7.2",
"doctrine/common": "^2.11"
"doctrine/common": "^2.11",
"doctrine/persistence": "^1.3.3"
},
"conflict": {
"doctrine/phpcr-odm": "<1.3.0"
Expand All @@ -25,7 +26,7 @@
"doctrine/coding-standard": "^6.0",
"doctrine/dbal": "^2.5.4",
"doctrine/mongodb-odm": "^1.3.0",
"doctrine/orm": "^2.5.4",
"doctrine/orm": "^2.7.0",
"phpunit/phpunit": "^7.0"
},
"suggest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
use Doctrine\Common\DataFixtures\Purger\PurgerInterface;
use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Common\DataFixtures\SharedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Exception;
use function get_class;
use function interface_exists;
use function sprintf;

/**
Expand Down Expand Up @@ -139,3 +140,5 @@ public function purge()
*/
abstract public function execute(array $fixtures, $append = false);
}

interface_exists(ObjectManager::class);
5 changes: 4 additions & 1 deletion lib/Doctrine/Common/DataFixtures/FixtureInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

namespace Doctrine\Common\DataFixtures;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use function interface_exists;

/**
* Interface contract for fixture classes to implement.
Expand All @@ -16,3 +17,5 @@ interface FixtureInterface
*/
public function load(ObjectManager $manager);
}

interface_exists(ObjectManager::class);
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/DataFixtures/ReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Doctrine\Common\DataFixtures;

use BadMethodCallException;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ODM\PHPCR\DocumentManager as PhpcrDocumentManager;
use Doctrine\Persistence\ObjectManager;
use OutOfBoundsException;
use function array_key_exists;
use function array_keys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use InvalidArgumentException;
use RuntimeException;
use function array_search;
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Common/DataFixtures/FixtureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\Tests\Common\DataFixtures;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

/**
* Test Fixture interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

/**
* Test Fixture ordering.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testGetAssociationTables()
$method = $class->getMethod('getAssociationTables');
$method->setAccessible(true);
$associationTables = $method->invokeArgs($purger, [[$metadata], $platform]);
$this->assertEquals($associationTables[0], 'readers.author_reader');
$this->assertEquals($associationTables[0], 'readers__author_reader');
}

public function testGetAssociationTablesQuoted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
use BadMethodCallException;
use Doctrine\Common\DataFixtures\Event\Listener\ORMReferenceListener;
use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Proxy\Proxy;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\ORM\UnitOfWork;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Tests\Common\DataFixtures\TestEntity\Role;
use OutOfBoundsException;
use Prophecy\Prophecy\ProphecyInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TestFixtures;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

class MyFixture1 implements FixtureInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace TestFixtures;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

class MyFixture2 implements FixtureInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Common\DataFixtures\SharedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Tests\Common\DataFixtures\TestEntity\Role;

class RoleFixture implements SharedFixtureInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\Tests\Common\DataFixtures\TestFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Tests\Common\DataFixtures\TestEntity\User;

class UserFixture extends AbstractFixture
Expand Down

0 comments on commit 89594f4

Please sign in to comment.