-
-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Labels
enhancementNew feature or requestNew feature or request
Description
| Q | A |
|---|---|
| Foundry's version? | 8.0.5 |
| PHP version | 8.4 |
| PHPUnit version | 13 |
symfony/framework-bundle version? |
8.0.5 |
| Do you use dama/doctrine-test-bundle? | no |
| Which reset database strategy do you use? | schema |
| Do you use Foundry's PHPUnit extension? | yes |
I've previously post an issue #1038, detecting an issue in the availability of Children fron parent inside Factory afterInstantiate method.
But it seem, there is another problem with doctrine cascade, I do a little reproducer: https://github.com/mpiot/zenstruck-foundry-issue-1100.
If we create 3 entities:
- A: Parent, OneToMany on B
- B: First child, ManyToOne on A, OneToMany on C
- C: Second Child, ManyToOne on B
Each entity having a PrePersist EventListener, Doctrine and Factory call them in the same order:
- A: PrePersist
- B: PrePersist
- C: PrePersist
But there is a difference in collection accessibility:
- Doctrine:
- A PrePersist: Count of Bs: 1
- B PrePersist: Count of Cs: 1
- B PrePersist: Has A: yes
- C PrePersist: Has B: yes
- Factory:
- A PrePersist: Count of Bs: 0
- B PrePersist: Count of Cs: 0
- B PrePersist: Has A: yes
- C PrePersist: Has B: yes
How to use reproducer:
https://github.com/mpiot/zenstruck-foundry-issue-1100
docker compose up
symfony server:start -d
APP_ENV=test symfony php bin/phpunit
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request