Skip to content
Permalink
Browse files

Include the remaining methods in TypeInterface.

A few methods were missed originally, and now that Type implements the
interface we can streamline the API docs as well.
  • Loading branch information...
markstory committed Aug 7, 2016
1 parent c54b7d5 commit 5706620fde5b81ecfefe0b120cc0c264ad8bcc3f
Showing with 25 additions and 34 deletions.
  1. +6 −33 src/Database/Type.php
  2. +19 −1 src/Database/TypeInterface.php
@@ -174,34 +174,23 @@ public static function clear()
}
/**
* Returns type identifier name for this object
*
* @return string
* {@inheritDoc}
*/
public function getName()
{
return $this->_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
* {@inheritDoc}
*/
public function getBaseType()
{
return $this->_name;
}
/**
* Casts given value from a PHP type to one acceptable by database
*
* @param mixed $value value to be converted to database equivalent
* @param \Cake\Database\Driver $driver object from which database preferences and configuration will be extracted
* @return mixed
* {@inheritDoc}
*/
public function toDatabase($value, Driver $driver)
{
@@ -244,11 +233,7 @@ protected function _basicTypeCast($value)
}
/**
* Casts give value to Statement equivalent
*
* @param mixed $value value to be converted to PHP equivalent
* @param \Cake\Database\Driver $driver object from which database preferences and configuration will be extracted
* @return mixed
* {@inheritDoc}
*/
public function toStatement($value, Driver $driver)
{
@@ -296,27 +281,15 @@ public static function strval($value)
}
/**
* 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
* {@inheritDoc}
*/
public function newId()
{
return null;
}
/**
* 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.
* {@inheritDoc}
*/
public function marshal($value)
{
@@ -9,7 +9,7 @@
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.2.13
* @since 3.2.14
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Database;
@@ -68,4 +68,22 @@ public function marshal($value);
* @return string
*/
public function getBaseType();
/**
* Returns type identifier name for this object
*
* @return string
*/
public function getName();
/**
* 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();
}

0 comments on commit 5706620

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