PDO (PHP Data Objects) Is Not a Fluent Interface
- Details
- Last Updated on Saturday, 11 June 2011 10:53
- Published on Wednesday, 08 June 2011 16:04
- Written by David L Norris
Problem
PDO does not provide a fluent interface contrary to the claims of many. It is deceiving because it looks like a fluent interface on the surface due to its support of method chaining on some objects. However, PDO doesn't even support method chaining properly. It does not consistently throw exceptions and instead often uses return values of false to indicate failure. PDO::query in particular leaves you with a "Fatal error: (method name) method called on non-object" when an error occurs.
View Solution: PDO (PHP Data Objects) Is Not a Fluent Interface