-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3.6: Bring back guards against fixtures with constructor arguments Fix wrong namespace for existing test Remove types for php 5.6 support Copy IntegrationTest from DoctrineFixturesBundle Fixtures as services + group support Update registration of ResolveTargetDocumentListener Fix link to PHP7 usage instructions
- Loading branch information
Showing
20 changed files
with
919 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
final class FixturesCompilerPass implements CompilerPassInterface | ||
{ | ||
public const FIXTURE_TAG = 'doctrine.fixture.odm.mongodb'; | ||
|
||
public function process(ContainerBuilder $container) | ||
{ | ||
$definition = $container->getDefinition('doctrine_mongodb.odm.symfony.fixtures.loader'); | ||
$taggedServices = $container->findTaggedServiceIds(self::FIXTURE_TAG); | ||
|
||
$fixtures = []; | ||
foreach ($taggedServices as $serviceId => $tags) { | ||
$groups = []; | ||
foreach ($tags as $tagData) { | ||
if (! isset($tagData['group'])) { | ||
continue; | ||
} | ||
|
||
$groups[] = $tagData['group']; | ||
} | ||
|
||
$fixtures[] = [ | ||
'fixture' => new Reference($serviceId), | ||
'groups' => $groups, | ||
]; | ||
} | ||
|
||
$definition->addMethodCall('addFixtures', [$fixtures]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Bundle\MongoDBBundle\Fixture; | ||
|
||
use Doctrine\Common\DataFixtures\AbstractFixture; | ||
|
||
/** | ||
* Base class designed for data fixtures so they don't have to extend and | ||
* implement different classes/interfaces according to their needs. | ||
*/ | ||
abstract class Fixture extends AbstractFixture implements ODMFixtureInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Bundle\MongoDBBundle\Fixture; | ||
|
||
/** | ||
* FixtureGroupInterface can be implemented by fixtures that belong in groups | ||
*/ | ||
interface FixtureGroupInterface | ||
{ | ||
/** | ||
* This method must return an array of groups | ||
* on which the implementing class belongs to | ||
* | ||
* @return string[] | ||
*/ | ||
public static function getGroups(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Bundle\MongoDBBundle\Fixture; | ||
|
||
use Doctrine\Common\DataFixtures\FixtureInterface; | ||
|
||
/** | ||
* Marks your fixtures that are specifically for the ODM. | ||
*/ | ||
interface ODMFixtureInterface extends FixtureInterface | ||
{ | ||
} |
Oops, something went wrong.