zenstruck / foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html
MIT License
643 stars 70 forks source link

How to fix deprecation notices #650

Closed asispts closed 3 months ago

asispts commented 3 months ago

After upgrading to v2, I got lots of deprecation notices

[info] User Deprecated: The "Zenstruck\Foundry\ObjectFactory::create()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::find()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::findOrCreate()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomOrCreate()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomSet()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomRange()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::findBy()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::random()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::first()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::last()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::all()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::repository()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[info] User Deprecated: The "Zenstruck\Foundry\Persistence\RepositoryDecorator" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator".

Any idea how to fix this issue?

nikophil commented 3 months ago

That's strange that you've been reported indirect deprecation notices :thinking:

are you using Symfony's PHPUnit bridge?

nikophil commented 3 months ago

those are internal to Foundry, and can be safely ignored

asispts commented 3 months ago

Yeah, I know. Those notices appear when running bin/console doctrine:fixture:load, which will clutter your console, especially when you also use monolog bundle.

I can safely ignore the notices during testing, so it's not a problem.

nikophil commented 3 months ago

I don't know if you cna say to monolog that it should only report "direct" deprecations :shrug:

not sure how you can ignore them beside of removing deprecation channel from the console handler (but that would mute all deprecations)

asispts commented 3 months ago

Without Monolog, you get the logs shown above. At least it doesn't flood the console.

Here’s what the log looks like when Monolog is enabled.
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\ObjectFactory::create()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\ObjectFactory::create()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::find()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::find()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::findOrCreate()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::findOrCreate()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomOrCreate()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomOrCreate()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomSet()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomSet()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomRange()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::randomRange()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::findBy()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::findBy()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::random()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::random()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::first()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::first()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::last()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::last()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::all()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::all()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:09 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::repository()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\PersistentObjectFactory::repository()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 {
        › 
        › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
        › 
      }
    }
  }
]
12:23:10 INFO      [deprecation] User Deprecated: The "Zenstruck\Foundry\Persistence\RepositoryDecorator" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator".
[
  "exception" => ErrorException {
    #message: "User Deprecated: The "Zenstruck\Foundry\Persistence\RepositoryDecorator" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator"."
    #code: 0
    #file: "/project/vendor/symfony/error-handler/DebugClassLoader.php"
    #line: 341
    #severity: E_USER_DEPRECATED
    trace: {
      /project/vendor/symfony/error-handler/DebugClassLoader.php:341 { …}
      /project/vendor/zenstruck/foundry/src/Persistence/PersistentObjectFactory.php:86 { …}
      /project/vendor/zenstruck/foundry/src/Persistence/PersistentProxyObjectFactory.php:65 { …}
      /project/vendor/zenstruck/foundry/src/Factory.php:156 { …}
      /project/vendor/zenstruck/foundry/src/ObjectFactory.php:47 { …}
      /project/vendor/zenstruck/foundry/src/Persistence/PersistentObjectFactory.php:209 { …}
      /project/vendor/zenstruck/foundry/src/FactoryCollection.php:73 { …}
      Zenstruck\Foundry\FactoryCollection::Zenstruck\Foundry\{closure}() {}
      /project/vendor/zenstruck/foundry/src/FactoryCollection.php:73 { …}
      /project/vendor/zenstruck/foundry/src/Factory.php:72 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/AbstractExecutor.php:122 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:26 { …}
      /project/vendor/doctrine/orm/src/EntityManager.php:182 { …}
      /project/vendor/doctrine/data-fixtures/src/Executor/ORMExecutor.php:20 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/LoadDataFixturesDoctrineCommand.php:140 { …}
      /project/vendor/doctrine/doctrine-fixtures-bundle/src/Command/CommandCompatibility.php:18 { …}
      /project/vendor/symfony/console/Command/Command.php:279 { …}
      /project/vendor/symfony/console/Application.php:1047 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:123 { …}
      /project/vendor/symfony/console/Application.php:316 { …}
      /project/vendor/symfony/framework-bundle/Console/Application.php:77 { …}
      /project/vendor/symfony/console/Application.php:167 { …}
      /project/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
      /project/vendor/autoload_runtime.php:29 { …}
      /project/bin/console:11 { …}
    }
  }
]

So, I'm not sure. Either need to fix the deprecation or find a way to prevent the logs from showing in the console.

nikophil commented 3 months ago

what I don't understand is why you got these notices. In my applications using foundry 2, they don't even show up :thinking:

asispts commented 3 months ago

When creating a reproducer, I found that the issue is caused by the -vvv flag that I use when running the command. Without the flag, the log doesn't show up.

fouteox commented 1 week ago

Hi @nikophil

I have the same problem and yes I use phpunit-bridge because it is automatically installed with zenstruck/browser. How to fix this problem?

nikophil commented 1 week ago

I use phpunit-bridge because it is automatically installed with zenstruck/browser

symfony/phpunit-bridge is a dev dependency of browser, so it has no impact on your dependencies

How to fix this problem?

see https://github.com/zenstruck/foundry/issues/680#issuecomment-2355440967