CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • Connection
  • Driver
  • FieldTypeConverter
  • FunctionsBuilder
  • Query
  • SchemaCache
  • Type
  • TypeMap

Interfaces

  • DriverInterface
  • ExpressionInterface
  • StatementInterface
  • TypedResultInterface
  • TypeInterface

Traits

  • SqlDialectTrait
  • TypeConverterTrait
  • TypedResultTrait
  • TypeMapTrait

Exceptions

  • Exception
  1: <?php
  2: /**
  3:  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4:  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5:  *
  6:  * Licensed under The MIT License
  7:  * For full copyright and license information, please see the LICENSE.txt
  8:  * Redistributions of files must retain the above copyright notice.
  9:  *
 10:  * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 11:  * @link          https://cakephp.org CakePHP(tm) Project
 12:  * @since         3.0.0
 13:  * @license       https://opensource.org/licenses/mit-license.php MIT License
 14:  */
 15: namespace Cake\Database;
 16: 
 17: /*
 18:  * Represents a class that holds a TypeMap object
 19:  */
 20: /**
 21:  * Trait TypeMapTrait
 22:  */
 23: trait TypeMapTrait
 24: {
 25:     /**
 26:      * @var \Cake\Database\TypeMap
 27:      */
 28:     protected $_typeMap;
 29: 
 30:     /**
 31:      * Creates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one.
 32:      *
 33:      * @param array|\Cake\Database\TypeMap $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap
 34:      * @return $this
 35:      */
 36:     public function setTypeMap($typeMap)
 37:     {
 38:         $this->_typeMap = is_array($typeMap) ? new TypeMap($typeMap) : $typeMap;
 39: 
 40:         return $this;
 41:     }
 42: 
 43:     /**
 44:      * Returns the existing type map.
 45:      *
 46:      * @return \Cake\Database\TypeMap
 47:      */
 48:     public function getTypeMap()
 49:     {
 50:         if ($this->_typeMap === null) {
 51:             $this->_typeMap = new TypeMap();
 52:         }
 53: 
 54:         return $this->_typeMap;
 55:     }
 56: 
 57:     /**
 58:      * Creates a new TypeMap if $typeMap is an array, otherwise returns the existing type map
 59:      * or exchanges it for the given one.
 60:      *
 61:      * @deprecated 3.4.0 Use setTypeMap()/getTypeMap() instead.
 62:      * @param array|\Cake\Database\TypeMap|null $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap
 63:      * @return $this|\Cake\Database\TypeMap
 64:      */
 65:     public function typeMap($typeMap = null)
 66:     {
 67:         deprecationWarning(
 68:             'TypeMapTrait::typeMap() is deprecated. ' .
 69:             'Use TypeMapTrait::setTypeMap()/getTypeMap() instead.'
 70:         );
 71:         if ($typeMap !== null) {
 72:             return $this->setTypeMap($typeMap);
 73:         }
 74: 
 75:         return $this->getTypeMap();
 76:     }
 77: 
 78:     /**
 79:      * Overwrite the default type mappings for fields
 80:      * in the implementing object.
 81:      *
 82:      * This method is useful if you need to set type mappings that are shared across
 83:      * multiple functions/expressions in a query.
 84:      *
 85:      * To add a default without overwriting existing ones
 86:      * use `getTypeMap()->addDefaults()`
 87:      *
 88:      * @param array $types The array of types to set.
 89:      * @return $this
 90:      * @see \Cake\Database\TypeMap::setDefaults()
 91:      */
 92:     public function setDefaultTypes(array $types)
 93:     {
 94:         $this->getTypeMap()->setDefaults($types);
 95: 
 96:         return $this;
 97:     }
 98: 
 99:     /**
100:      * Gets default types of current type map.
101:      *
102:      * @return array
103:      */
104:     public function getDefaultTypes()
105:     {
106:         return $this->getTypeMap()->getDefaults();
107:     }
108: 
109:     /**
110:      * Allows setting default types when chaining query
111:      *
112:      * @deprecated 3.4.0 Use setDefaultTypes()/getDefaultTypes() instead.
113:      * @param array|null $types The array of types to set.
114:      * @return $this|array
115:      */
116:     public function defaultTypes(array $types = null)
117:     {
118:         deprecationWarning(
119:             'TypeMapTrait::defaultTypes() is deprecated. ' .
120:             'Use TypeMapTrait::setDefaultTypes()/getDefaultTypes() instead.'
121:         );
122:         if ($types !== null) {
123:             return $this->setDefaultTypes($types);
124:         }
125: 
126:         return $this->getDefaultTypes();
127:     }
128: }
129: 
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs