Skip to content

Commit

Permalink
Merge branch 'master' into 3.next
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 6, 2016
2 parents d55d340 + c54b7d5 commit e65f13f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/Database/Type.php
Expand Up @@ -21,7 +21,7 @@
* Encapsulates all conversion functions for values coming from database into PHP and
* going from PHP into database.
*/
class Type
class Type implements TypeInterface
{

/**
Expand Down
16 changes: 2 additions & 14 deletions src/Database/Type/BinaryType.php
Expand Up @@ -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;

Expand All @@ -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
{

/**
Expand All @@ -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.
*
Expand Down
16 changes: 2 additions & 14 deletions src/Database/Type/BoolType.php
Expand Up @@ -15,6 +15,7 @@
namespace Cake\Database\Type;

use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use InvalidArgumentException;
use PDO;
Expand All @@ -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
{

/**
Expand All @@ -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.
*
Expand Down
3 changes: 2 additions & 1 deletion src/Database/Type/DateTimeType.php
Expand Up @@ -15,6 +15,7 @@
namespace Cake\Database\Type;

use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use DateTimeInterface;
use Exception;
Expand All @@ -26,7 +27,7 @@
*
* Use to convert datetime instances to strings & back.
*/
class DateTimeType implements TypeInterface
class DateTimeType extends Type implements TypeInterface
{

/**
Expand Down
16 changes: 2 additions & 14 deletions src/Database/Type/FloatType.php
Expand Up @@ -15,6 +15,7 @@
namespace Cake\Database\Type;

use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use PDO;
use RuntimeException;
Expand All @@ -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
{

/**
Expand All @@ -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
*
Expand Down
47 changes: 2 additions & 45 deletions src/Database/Type/IntegerType.php
Expand Up @@ -15,6 +15,7 @@
namespace Cake\Database\Type;

use Cake\Database\Driver;
use Cake\Database\Type;
use Cake\Database\TypeInterface;
use InvalidArgumentException;
use PDO;
Expand All @@ -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.
*
Expand Down
10 changes: 10 additions & 0 deletions src/Database/TypeInterface.php
Expand Up @@ -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 e65f13f

Please sign in to comment.