Skip to main content
9 events
when toggle format what by license comment
May 23, 2017 at 12:41 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Sep 10, 2014 at 18:02 comment added cHao As for point 4: Aside from stopping the flow of information (and in particular, error messages) to code that could do something useful with it, die() makes it more of a pain -- if not outright impossible -- to run automated tests (like, say, unit tests). I've run into this before; if you're not anticipating such ugliness, an error can cause the whole test suite to just stop dead in its tracks, possibly without even so much as a visible error message or nonzero exit code.
Apr 7, 2014 at 20:41 comment added palacsint @jshjohnson: Huh, good question. Object relational mapping has its issues: en.wikipedia.org/wiki/Object-relational_impedance_mismatch. Anyway, I've put another link into the post and here are two ideas: create a builder; move the register method into the Freelancer class. In the latter case you might also get a better a API with a builder but it might not worth it. I guess it depend on the size of the project.
Apr 7, 2014 at 20:32 history edited palacsint CC BY-SA 3.0
adds a link
Apr 7, 2014 at 10:31 comment added jshjohnson Just re-reading through this. Could you perhaps elaborate what you mean regarding a parameter object? If I declared a new Freelancers object, how would the function get the data passed to it?
Mar 22, 2014 at 10:35 comment added palacsint @jshjohnson: I'm happy that you've found it useful. I don't think that the exception message (which I guess contains some database-related message) would be useful for a user but anyway, test it and decide. (And don't forget to log it.) I've just written another answer here about the same topic, check #3.
Mar 22, 2014 at 10:20 vote accept jshjohnson
Mar 22, 2014 at 10:19 comment added jshjohnson Wow, this is seriously informative and exactly what I was looking for! Thanks. As an alternative to die(), would you recommend using something like: echo 'Caught exception: ', $e->getMessage(), "\n";?
Mar 22, 2014 at 5:08 history answered palacsint CC BY-SA 3.0