foundry: [2.0] Problem with inversed `OneToOne` relationships
Hello there,
Iām upgrading a project from 1.38 to 2.0. With the Rector rule, the upgrade is really smooth, thanks @nikophil !
I just have a minor issue, in one Factory, in the defaults() method, Iām doing something like this :
protected function defaults(): array
{
return [
'customer' => CustomerFactory::new()->withUser(),
];
}
And in Customer factory :
public function withUser(): self
{
return $this->with(static fn (): array => ['user' => UserFactory::new()]);
}
With Foundry 1.38, my Customer was containing an User, since 2.0 User is always null. Is it something deprecated or a bug ?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (11 by maintainers)
yes thanks for this, I do see where it comes from, and I currently have no solution, have to dig a little bit more https://github.com/zenstruck/foundry/pull/659#discussion_r1658634353
@nikophil Still OK for me š
Hi!
Thank you for your work. Iām pretty busy atm, I will test it and get back with the results in a couple days and create a reproducer demo if necessary.
Hi!
it created me a lot more errors than I originally had š I will investigate more and come back with the results
with 2.2.2: Tests: 58, Assertions: 215, Errors: 3 with dev-fix/inversed-one-to-one: Tests: 58, Assertions: 67, Errors: 34.
Hi @nikophil, I confirm the issue is fixed with your patch, thanks !