Skip to main content
7 events
when toggle format what by license comment
May 23, 2017 at 12:40 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Nov 1, 2011 at 15:03 history migrated from stackoverflow.com (revisions)
Oct 31, 2011 at 19:20 vote accept CommunityBot
Oct 31, 2011 at 19:05 comment added Zak The one other thing I would probably do is create a "Stock" class that my mapper could populate with the data array from the database. Then I get a first class object instead of a PHP array as a return value.
Oct 31, 2011 at 19:04 comment added Zak I'd probably log the exception in a logger and in turn throw another exception that my outer code could catch. Your outer code shouldn't need to know that the stock mapper is internally using a DB or PDO as it's data storage/retrieval.
Oct 31, 2011 at 18:42 comment added Rob perfect!, that seems like a more logic and better way to handle this. Would you have any advice how to handle the PDOException in this example? Would you add it as a function('s) to getStockById?
Oct 31, 2011 at 18:26 history answered Zak CC BY-SA 3.0