Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.7.x' into 4.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Nov 28, 2024
2 parents 39cc93d + 3004c9b commit 0553401
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.2.0"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.3.0"
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v4"
uses: "codecov/codecov-action@v5"
with:
directory: reports
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@5.2.0"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@5.3.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ on:

jobs:
static-analysis:
uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.2.0"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.3.0"
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
],
"require": {
"php": "^8.1",
"doctrine/data-fixtures": "^1.3",
"doctrine/data-fixtures": "^1.5|^2.0",
"doctrine/doctrine-bundle": "^2.2",
"doctrine/orm": "^2.14.0 || ^3.0",
"doctrine/persistence": "^2.4|^3.0",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/doctrine-bridge": "^5.4|^6.0|^7.0",
"symfony/doctrine-bridge": "^5.4.48|^6.4.16|^7.1.9",
"symfony/http-kernel": "^5.4|^6.0|^7.0"
},
"require-dev": {
Expand Down
20 changes: 10 additions & 10 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Create a fixtures class and start adding products::

class AppFixtures extends Fixture
{
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
// create 20 products! Bam!
for ($i = 0; $i < 20; $i++) {
Expand Down Expand Up @@ -102,7 +102,7 @@ injection::
}

// ...
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$user = new User();
$user->setUsername('admin');
Expand Down Expand Up @@ -148,7 +148,7 @@ exact same object via its name.
{
public const ADMIN_USER_REFERENCE = 'admin-user';
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$userAdmin = new User('admin', 'pass_1234');
$manager->persist($userAdmin);
Expand All @@ -165,7 +165,7 @@ exact same object via its name.
// ...
class GroupFixtures extends Fixture
{
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$userGroup = new Group('administrators');
// this reference returns the User object created in UserFixtures
Expand Down Expand Up @@ -197,7 +197,7 @@ an array of the fixture classes that must be loaded before this one::
// ...
class UserFixtures extends Fixture
{
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
// ...
}
Expand All @@ -211,12 +211,12 @@ an array of the fixture classes that must be loaded before this one::

class GroupFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
// ...
}

public function getDependencies()
public function getDependencies(): array
{
return [
UserFixtures::class,
Expand Down Expand Up @@ -304,7 +304,7 @@ You can also customize purging behavior significantly more and implement a custo
// ...
class CustomPurger implements PurgerInterface
{
public function purge() : void
public function purge(): void
{
// ...
}
Expand Down Expand Up @@ -358,7 +358,7 @@ The next step is to register our custom purger factory and specify its alias.
use App\Purger\CustomerPurgerFactory;
return function(ContainerConfigurator $configurator) : void {
return function(ContainerConfigurator $configurator): void {
$services = $configurator->services();
$services->set(CustomerPurgerFactory::class)
Expand Down Expand Up @@ -412,7 +412,7 @@ Then, enable Dependency Injection for the ``fixtures`` directory:
// config/services.php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function(ContainerConfigurator $container) : void {
return function(ContainerConfigurator $container): void {
$services = $container->services()
->defaults()
->autowire()
Expand Down
20 changes: 18 additions & 2 deletions src/Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Psr\Log\AbstractLogger;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -126,9 +127,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$input->getOption('purge-with-truncate'),
);
$executor = new ORMExecutor($em, $purger);
$executor->setLogger(static function ($message) use ($ui): void {
$ui->text(sprintf(' <comment>></comment> <info>%s</info>', $message));
$executor->setLogger(new class ($ui) extends AbstractLogger {
public function __construct(private SymfonyStyle $ui)
{
}

/** {@inheritDoc} */
public function log($level, $message, array $context = []): void
{
$this->ui->text(sprintf(' <comment>></comment> <info>%s</info>', $message));
}

/** @deprecated to be removed when dropping support for doctrine/data-fixtures <1.8 */
public function __invoke(string $message): void
{
$this->log(0, $message);
}
});

$executor->execute($fixtures, $input->getOption('append'));

return 0;
Expand Down
10 changes: 5 additions & 5 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\RequiredConstructorArgsFixtures;
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\WithDeepDependenciesFixtures;
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\WithDependenciesFixtures;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\Common\DataFixtures\Purger\ORMPurgerInterface;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManagerInterface;
Expand Down Expand Up @@ -302,7 +302,7 @@ public function testRunCommandWithDefaultPurger(): void
$container->set('doctrine', $registry);

$purgerFactory = $this->createMock(PurgerFactory::class);
$purger = $this->createMock(ORMPurger::class);
$purger = $this->createMock(ORMPurgerInterface::class);
$purgerFactory
->expects(self::once())
->method('createForEntityManager')
Expand Down Expand Up @@ -349,7 +349,7 @@ public function testRunCommandWithPurgeExclusions(): void
$container->set('doctrine', $registry);

$purgerFactory = $this->createMock(PurgerFactory::class);
$purger = $this->createMock(ORMPurger::class);
$purger = $this->createMock(ORMPurgerInterface::class);
$purgerFactory
->expects(self::once())
->method('createForEntityManager')
Expand Down Expand Up @@ -399,7 +399,7 @@ public function testRunCommandWithCustomPurgerAndCustomEntityManager(): void
$container->set('doctrine', $registry);

$purgerFactory = $this->createMock(PurgerFactory::class);
$purger = $this->createMock(ORMPurger::class);
$purger = $this->createMock(ORMPurgerInterface::class);
$purgerFactory
->expects(self::once())
->method('createForEntityManager')
Expand Down Expand Up @@ -446,7 +446,7 @@ public function testRunCommandWithPurgeMode(): void
$container->set('doctrine', $registry);

$purgerFactory = $this->createMock(PurgerFactory::class);
$purger = $this->createMock(ORMPurger::class);
$purger = $this->createMock(ORMPurgerInterface::class);
$purgerFactory
->expects(self::once())
->method('createForEntityManager')
Expand Down

0 comments on commit 0553401

Please sign in to comment.