BoolType supports a public factory-method get() and implements a fly-weight pattern, which seems to imply you could use this to generate a custom BoolType instance, on the fly, for a specific column.
That doesn't work in practice - the column factory-methods in Table only accept a class-name string, which means that all types must be registered up front.
Perhaps that's not a bad thing - explicitly defining types up front has the expected performance characteristics and avoids implementing a fly-weight pattern and/or manually registering types under some other name besides the class-name.
Suggestion:
Remove get get() factory-method, and make the BoolType constructor public.
Keep the default true, false arguments as-is.
This will make it easy to extend BoolType into a custom BoolType, which is in fact already possible with e.g.:
class MySQLBoolType extends BoolType
{
public function __construct()
{
parent::__construct("1", "0");
}
}
Lets remove the confusing/misleading factory-method though.
BoolType
supports a public factory-methodget()
and implements a fly-weight pattern, which seems to imply you could use this to generate a customBoolType
instance, on the fly, for a specific column.That doesn't work in practice - the column factory-methods in
Table
only accept a class-namestring
, which means that all types must be registered up front.Perhaps that's not a bad thing - explicitly defining types up front has the expected performance characteristics and avoids implementing a fly-weight pattern and/or manually registering types under some other name besides the class-name.
Suggestion:
Remove get
get()
factory-method, and make theBoolType
constructorpublic
.Keep the default
true
,false
arguments as-is.This will make it easy to extend
BoolType
into a customBoolType
, which is in fact already possible with e.g.:Lets remove the confusing/misleading factory-method though.