foundry icon indicating copy to clipboard operation
foundry copied to clipboard

2.x checklist

Open kbond opened this issue 2 years ago • 2 comments

(to be moved to 2.x PR)

  • [x] remove deprecated code
  • [ ] migrate remaining features from foundry-next
  • [ ] deprecate Zenstruck\Foundry\anonymous() in favor of Zenstruck\Foundry\factory()
  • [ ] split packages? (foundry-persistence, foundry-orm, foundry-mongo)
  • [ ] remove requirement/need for zenstruck/callback
  • [ ] Attributes can be a callable that accepts an int (marking the current # being created when creating a collection)

kbond avatar Nov 07 '23 20:11 kbond

  • [ ] inverse_one_to_many_relationship_without_cascade() https://github.com/kbond/foundry-next/pull/12
  • [x] fixed by https://github.com/kbond/foundry-next/pull/17
    • [x] one_to_many_with_two_relationships_same_entity()
    • [x] one_to_many_with_two_relationships_same_entity_and_adders()
    • [x] can_use_adder_as_attributes()
    • [x] inverse_many_to_many_with_two_relationships_same_entity()
    • [x] one_to_many_polymorphic_with_nested_collection_relationship()
  • [x] ModelFactoryTest::can_set_state_via_new => https://github.com/zenstruck/foundry/pull/559
  • [x] fixed by https://github.com/kbond/foundry-next/pull/22
    • [x] ODMModelFactoryTest::can_use_adder_as_attributes
    • [x] ODMModelFactoryTest::can_find_or_create_from_proxy_of_object
    • [x] ODMModelFactoryTest::can_hydrate_embed_many_fields
    • [x] ODMModelFactoryTest::can_use_factory_for_embedded_object

Static analysis

  • [x] I think we have a complex SCA problem:
// 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<T>>::instantiateWith() expects (callable(array<string, mixed>, class-string<T&Zenstruck\Foundry\Persistence\Proxy<T>>): (T&Zenstruck\Foundry\Persistence\Proxy<T>))|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

nikophil avatar Dec 21 '23 17:12 nikophil

I'm adding some todo here both of these PRs should be ported in 2.x:

  • [x] https://github.com/zenstruck/foundry/pull/577 (#587)
  • [x] https://github.com/zenstruck/foundry/pull/580
  • [x] https://github.com/zenstruck/foundry/pull/592 => https://github.com/zenstruck/foundry/pull/600

nikophil avatar Apr 03 '24 06:04 nikophil