philipbrown / magniloquent

DEPRECATED, USE https://github.com/dwightwatson/validating
MIT License
70 stars 8 forks source link

fluent use of save method eg $user->force()->save(); #34

Open ps24love opened 10 years ago

ps24love commented 10 years ago

i added an attribute and a fluent method to allow use of save method without much parameters

philipbrown commented 10 years ago

Hi @ps24love thank you for the contribution :)

Why would this be better than passing the force argument as a parameter of the method?

To me this makes the code look nicer, but I'm not sure if it is a better solution.

What do you think @searsaw?

w3irdrobot commented 10 years ago

I say we have both and let the user decide which they want to use. This way anyone currently using the original style will not have broken code. We would need to add this to the README file, too.

philipbrown commented 10 years ago

Yeah, I definitely don't think we should break the original style.

ps24love commented 10 years ago

well it obviously have no added functionality and i agree with you about original style but i think it conveys meaning w/o the developer looking at the docs to decipher the 2nd param and secondly what if i wanted to force save w/o passing the first param e.g $user->save(array(),true), well there is no way to elegantly skip params in php. You chose a reasonable default which seems quite okay, but hard to maintain in edge cases and i chose a default that easy to swap out. thanks for your reply

philipbrown commented 10 years ago

Yeah I agree. Would you mind updating your pull request to maintain the old way too and I'll merge this straight in.

Thank you :)