zendframework / zend-expressive

PSR-15 middleware in minutes!
BSD 3-Clause "New" or "Revised" License
711 stars 197 forks source link

How are you organizing your factories as your project gets larger? #483

Closed exts closed 7 years ago

exts commented 7 years ago

Seems like there's a growing amount of factory classes as my project gets larger with more actions and middleware there's a paired factory to inject the dependencies I need for each and it seems just a bit unorganized by just throwing the factory class in the same folder.

Maybe it's just a weird feeling since this is the first time I've done single action classes instead of controllers which paired all these actions in one file and I'd only have to deal w/ one file to inject the dependencies rather than say 8 for a basic CRUD (pairing each one w/ factories for injecting for examples.

Is it just something I need to get used to, or is there a way to organize all these factory files?

froschdesign commented 7 years ago

With zend-servicemanager you have some options to reduce the number of factory classes:

Look also at this tutorial from Matthew Setter: "How To Do RAD Prototyping and Development With The ReflectionBasedAbstractFactory"

exts commented 7 years ago

Thanks for the resources :).I also just learned that middleware sent through the pipe doesn't require factories which is nice. actually that's false, I misread that last bit

froschdesign commented 7 years ago

Btw. please add your further questions to the new Zend Framework Forum, because this is a bug tracker and not a support forum. Thanks!

exts commented 7 years ago

@froschdesign that expressive link doesn't exist, don't think there are individual forums yet or it's not public to guest users?

froschdesign commented 7 years ago

@exts Mmmh, Login should help.

froschdesign commented 7 years ago

ping @weierophinney

exts commented 7 years ago

@froschdesign works now

kynx commented 7 years ago

Not for me :(

Error while trying to load Something went wrong.

exts commented 7 years ago

@kynx make sure you're logged in

froschdesign commented 7 years ago

@kynx Problem fixed! See: zendframework/zf3-web#68