-
-
Notifications
You must be signed in to change notification settings - Fork 142
Description
This is a design problem:
IConnection
interface's method IConnection::query
is coupled with a concrete implementation (Result
) that is not extensible in any meaningful way.
We need to be able to provide our own result objects. Now since IConnection::query
only allows returning Result
and subclassing Result is useless because of private
props and final
methods, we are not able to do so.
Even implementing one's own IConnection
will not work because of the interface.
Currently, the only possible solution is not to use the interface and proxy the calls - for the whole Connection
and Result
classes. This is tedious and leads to possible bugs. Plus any code expecting IConnection
, Connection
or Result
is unusable.
Possible solution
private
-->protected
and remove thefinal
keywords- come up with an interface for
Result
objects
The actual use-case
Under special circumstances I do not want any exceptions to be thrown while using Dibi for DB querying.
Without relying on the calling code to be responsible for wrapping the calls with try-catch blocks.
This is currently not possible due to the aforementioned design limitation.
It would normally be very easy to just extend the Connection
and Result
classes and wrap the internal parent calls with try-catch blocks.
This is arguably an edge-case,
but there's more use-cases for simply being able to extend Dibi. For example #357 demonstrates one where it would be easy to come up with own solution, but it's not possible as it stands now.