culttt / cribbb

http://cribbb.com
449 stars 99 forks source link

Models with repository(storage) responsibility. #10

Closed bweston92 closed 9 years ago

bweston92 commented 9 years ago

https://github.com/yellowflag/cribbb/blob/master/app/Domain/Model/Groups/Group.php#L152

Can you explain why you'd add members on the model rather then in the repository. If you swapped out the model implementation for another implementation then it may not have the ability to do that nicely.

Unless you're not catering for different implementations.

Thanks.

philipbrown commented 9 years ago

The Group object would never be swapped out because it's a Domain Object. You would swap out the storage, not the actual object that contains the business logic because then you would have to reimplement all of your business logic inside every implementation.

Hope that makes sense :smile: