Closed kbond closed 1 week ago
inverse_one_to_many_relationship_without_cascade()
https://github.com/kbond/foundry-next/pull/12one_to_many_with_two_relationships_same_entity()
one_to_many_with_two_relationships_same_entity_and_adders()
can_use_adder_as_attributes()
inverse_many_to_many_with_two_relationships_same_entity()
one_to_many_polymorphic_with_nested_collection_relationship()
ModelFactoryTest::can_set_state_via_new
=> https://github.com/zenstruck/foundry/pull/559ODMModelFactoryTest::can_use_adder_as_attributes
ODMModelFactoryTest::can_find_or_create_from_proxy_of_object
ODMModelFactoryTest::can_hydrate_embed_many_fields
ODMModelFactoryTest::can_use_factory_for_embedded_object
// SomeObjectFactory extends PersistentProxyObjectFactory
return $this->instantiateWith(
static fn () => new SomeObject()
)
this code results in this error (I've replaced the full object FQCN by T
for better readability)
Parameter #1 $instantiator of method Zenstruck\Foundry\ObjectFactory<T&Zenstruck\Foundry\Persistence\Proxy
>::instantiateWith() expects (callable(array<string, mixed>, class-string<T&Zenstruck\Foundry\Persistence\Proxy >): (T&Zenstruck\Foundry\Persistence\Proxy ))|Zenstruck\Foundry\Object\Instantiator, Closure(): T given.
=> phpstan wants a closure which returns a T&Proxy<T>
because the factory is a "persistence with proxy", and the template type is T&Proxy<T>
. I think this is a blocker
I'm adding some todo here both of these PRs should be ported in 2.x:
(to be moved to 2.x PR)
Zenstruck\Foundry\anonymous()
in favor ofZenstruck\Foundry\factory()
zenstruck/callback