foundry icon indicating copy to clipboard operation
foundry copied to clipboard

2.0 Ideas

Open kbond opened this issue 4 years ago • 4 comments

@wouterj and I have been discussing some potential changes for 2.0. This is a list of potential ideas:

  • [x] #37
  • [ ] Rename ProxyRepository to RepositoryDecorator and mark internal ("proxy" is a bit of a misnomer - it is actually a "decorator")
  • [ ] Remove Proxy and change Factory::create() to return the real doctrine entity. While the proxy idea is clever and sort of creates a "quasi" AR system for your entities, it can be confusing (to use and document)
  • [ ] Move the AR helpers (save, refresh, delete) to the ModelFactory/RepositoryDecorator and some stand alone helper functions
  • [ ] Investigate if ocramius/proxy-manager could be used for auto-refresh as this would be lost with removal of the Proxy
  • [x] Method names: $user = UserFactory::new()->create()->object() is unfortunate. The ->object() would be removed by removing the Proxy (above) but $user = UserFactory::new()->create() is still confusing... (solved in #111)
  • [x] #113
  • [ ] ModelFactory::repository()/AnonymousFactory::repository() to return the "real" repository for the entity
  • [x] #126
  • [x] Move reset env variables to config options (FOUNDRY_DISABLE_DATABASE_RESET, FOUNDRY_RESET_CONNECTIONS, FOUNDRY_RESET_OBJECT_MANAGERS)? https://github.com/zenstruck/foundry/pull/320
  • [x] Remove bundless usage. This is a vestigial feature that likely only I'm using (with no reason I can't switch to using the bundle). I believe only allowing bundle config would drastically reduce complexity. https://github.com/zenstruck/foundry/issues/319
  • [ ] [BC BREAK] make ModelFactory::getClass() public and remove ModelFactory::getEntityClass()? See #162 for details (specifically https://github.com/zenstruck/foundry/pull/162#discussion_r632956940)
  • [x] ODM Support (or at least make adding support for this easier)

kbond avatar Jan 16 '21 14:01 kbond

Method names: $user = UserFactory::new()->create()->object() is unfortunate. The ->object() would be removed by removing the Proxy (above) but $user = UserFactory::new()->create() is still confusing...

See #111 for a proposal to fix this

wouterj avatar Jan 16 '21 15:01 wouterj

Hello @kbond sorry if it's not the correct place to ask kind of things

Are you willing to supportdoctrine/odm in the future version this library?

nikophil avatar Apr 11 '21 17:04 nikophil

@nikophil the library is written based on doctrine/persistence (with some specific features requiring doctrine/orm). So there is a theoretical chance that this bundle supports doctrine/odm already (but afaik, it has never been tested).

wouterj avatar Apr 11 '21 17:04 wouterj

Nice to here that, I'm gonna try that on a project of mine which uses mongo I'm afraid it won't support embedded collections out of the box... I'll let you know

nikophil avatar Apr 11 '21 17:04 nikophil