|
|
@@ -17,7 +17,7 @@ namespace Cake\Database\Type;
|
|
|
use Cake\Core\Exception\Exception;
|
|
|
use Cake\Database\Driver;
|
|
|
use Cake\Database\Driver\Sqlserver;
|
|
|
-use Cake\Database\Type;
|
|
|
+use Cake\Database\TypeInterface;
|
|
|
use PDO;
|
|
|
|
|
|
/**
|
|
|
@@ -25,10 +25,40 @@ use PDO;
|
|
|
*
|
|
|
* Use to convert binary data between PHP and the database types.
|
|
|
*/
|
|
|
-class BinaryType extends Type
|
|
|
+class BinaryType implements TypeInterface
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
+ * Identifier name for this type
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $_name = null;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Constructor
|
|
|
+ *
|
|
|
+ * @param string|null $name The name identifying this type
|
|
|
+ */
|
|
|
+ public function __construct($name = null)
|
|
|
+ {
|
|
|
+ $this->_name = $name;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Returns the base type name that this class is inheriting.
|
|
|
+ * This is useful when extending base type for adding extra functionality
|
|
|
+ * but still want the rest of the framework to use the same assumptions it would
|
|
|
+ * do about the base type it inherits from.
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getBaseType()
|
|
|
+ {
|
|
|
+ return $this->_name;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Convert binary data into the database format.
|
|
|
*
|
|
|
* Binary data is not altered before being inserted into the database.
|
|
|
@@ -79,4 +109,19 @@ class BinaryType extends Type
|
|
|
{
|
|
|
return PDO::PARAM_LOB;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Marshalls flat data into PHP objects.
|
|
|
+ *
|
|
|
+ * Most useful for converting request data into PHP objects
|
|
|
+ * that make sense for the rest of the ORM/Database layers.
|
|
|
+ *
|
|
|
+ * @param mixed $value The value to convert.
|
|
|
+ *
|
|
|
+ * @return mixed Converted value.
|
|
|
+ */
|
|
|
+ public function marshal($value)
|
|
|
+ {
|
|
|
+ return $value;
|
|
|
+ }
|
|
|
}
|