Skip to content
Permalink
Browse files

Made all types extend Type again.

The previous change was too eager and broke both BC and several features in the
framework. Fixes #9216
  • Loading branch information...
lorenzo committed Aug 6, 2016
1 parent b27c486 commit 3b341696e13ad6aed51e330d8e54479a41780512
@@ -17,6 +17,7 @@
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,7 +26,7 @@
*
* Use to convert binary data between PHP and the database types.
*/
class BinaryType implements TypeInterface
class BinaryType extends Type implements TypeInterface
{
/**
@@ -45,19 +46,6 @@ 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.
*
@@ -15,6 +15,7 @@
namespace Cake\Database\Type;
use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use InvalidArgumentException;
use PDO;
@@ -24,7 +25,7 @@
*
* Use to convert bool data between PHP and the database types.
*/
class BoolType implements TypeInterface
class BoolType extends Type implements TypeInterface
{
/**
@@ -44,19 +45,6 @@ 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 bool data into the database format.
*
@@ -15,6 +15,7 @@
namespace Cake\Database\Type;
use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use DateTimeInterface;
use Exception;
@@ -26,7 +27,7 @@
*
* Use to convert datetime instances to strings & back.
*/
class DateTimeType implements TypeInterface
class DateTimeType extends Type implements TypeInterface
{
/**
@@ -15,6 +15,7 @@
namespace Cake\Database\Type;
use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use PDO;
use RuntimeException;
@@ -24,7 +25,7 @@
*
* Use to convert float/decimal data between PHP and the database types.
*/
class FloatType implements TypeInterface
class FloatType extends Type implements TypeInterface
{
/**
@@ -44,19 +45,6 @@ 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;
}
/**
* The class to use for representing number objects
*
@@ -15,6 +15,7 @@
namespace Cake\Database\Type;
use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use InvalidArgumentException;
use PDO;
@@ -24,53 +25,9 @@
*
* Use to convert integer data between PHP and the database types.
*/
class IntegerType implements TypeInterface
class IntegerType extends Type implements TypeInterface
{
/**
* Identifier name for this type
*
* @var string|null
*/
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;
}
/**
* Generate a new primary key value for a given type.
*
* This method can be used by types to create new primary key values
* when entities are inserted.
*
* @return mixed A new primary key value.
* @see \Cake\Database\Type\UuidType
*/
public function newId()
{
return null;
}
/**
* Convert integer data into the database format.
*
@@ -58,4 +58,14 @@ public function toStatement($value, Driver $driver);
* @return mixed Converted value.
*/
public function marshal($value);
/**
* 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();
}

0 comments on commit 3b34169

Please sign in to comment.
You can’t perform that action at this time.