Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only load doctrine/persistence class alias when using Faker\ORM\Doctrine #446

Merged
merged 3 commits into from Feb 2, 2022
Merged

Only load doctrine/persistence class alias when using Faker\ORM\Doctrine #446

merged 3 commits into from Feb 2, 2022

Conversation

icanhazstring
Copy link

@icanhazstring icanhazstring commented Feb 2, 2022

What is the reason for this PR?

This will fix a PHP warning when trying to add a class_alias for non existing classes.
This happens if Faker is used while doctrine/persistence is not. This problem was introduces with PR #414

Author's checklist

Summary of changes

Only load class aliases if Faker\ORM\Doctrine classes are autoloaded.

Review checklist

  • All checks have passed
  • Changes are approved by maintainer

Andreas Frömer added 3 commits February 2, 2022 05:28
This will also add autoload for phpstan to register the alias.
Each test will run in a separate process to make sure the autoload is done in every single one of them.
@icanhazstring icanhazstring changed the title Only load doctrine/persistence class alias if classes exist Only load doctrine/persistence class alias when using Faker\ORM\Doctrine Feb 2, 2022
@pimjansen pimjansen added the bug Something isn't working label Feb 2, 2022
Copy link

@pimjansen pimjansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pimjansen pimjansen merged commit 3a50490 into FakerPHP:main Feb 2, 2022
@icanhazstring icanhazstring deleted the faker-445 branch February 2, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning: Class "Doctrine\Persistence\Mapping\ClassMetadata" not found
2 participants