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

  • ConnectionManager
  • ConnectionRegistry
  • FactoryLocator
  • Paginator
  • QueryCacher
  • ResultSetDecorator
  • RulesChecker

Interfaces

  • ConnectionInterface
  • EntityInterface
  • FixtureInterface
  • InvalidPropertyInterface
  • PaginatorInterface
  • QueryInterface
  • RepositoryInterface
  • ResultSetInterface
  • SchemaInterface
  • TableSchemaInterface

Traits

  • EntityTrait
  • ModelAwareTrait
  • QueryTrait
  • RulesAwareTrait
  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\Datasource;
 16: 
 17: use Cake\Core\App;
 18: use Cake\Core\ObjectRegistry;
 19: use Cake\Datasource\Exception\MissingDatasourceException;
 20: 
 21: /**
 22:  * A registry object for connection instances.
 23:  *
 24:  * @see \Cake\Datasource\ConnectionManager
 25:  */
 26: class ConnectionRegistry extends ObjectRegistry
 27: {
 28:     /**
 29:      * Resolve a datasource classname.
 30:      *
 31:      * Part of the template method for Cake\Core\ObjectRegistry::load()
 32:      *
 33:      * @param string $class Partial classname to resolve.
 34:      * @return string|false Either the correct classname or false.
 35:      */
 36:     protected function _resolveClassName($class)
 37:     {
 38:         if (is_object($class)) {
 39:             return $class;
 40:         }
 41: 
 42:         return App::className($class, 'Datasource');
 43:     }
 44: 
 45:     /**
 46:      * Throws an exception when a datasource is missing
 47:      *
 48:      * Part of the template method for Cake\Core\ObjectRegistry::load()
 49:      *
 50:      * @param string $class The classname that is missing.
 51:      * @param string $plugin The plugin the datasource is missing in.
 52:      * @return void
 53:      * @throws \Cake\Datasource\Exception\MissingDatasourceException
 54:      */
 55:     protected function _throwMissingClassError($class, $plugin)
 56:     {
 57:         throw new MissingDatasourceException([
 58:             'class' => $class,
 59:             'plugin' => $plugin,
 60:         ]);
 61:     }
 62: 
 63:     /**
 64:      * Create the connection object with the correct settings.
 65:      *
 66:      * Part of the template method for Cake\Core\ObjectRegistry::load()
 67:      *
 68:      * If a callable is passed as first argument, The returned value of this
 69:      * function will be the result of the callable.
 70:      *
 71:      * @param string|object|callable $class The classname or object to make.
 72:      * @param string $alias The alias of the object.
 73:      * @param array $settings An array of settings to use for the datasource.
 74:      * @return object A connection with the correct settings.
 75:      */
 76:     protected function _create($class, $alias, $settings)
 77:     {
 78:         if (is_callable($class)) {
 79:             return $class($alias);
 80:         }
 81: 
 82:         if (is_object($class)) {
 83:             return $class;
 84:         }
 85: 
 86:         unset($settings['className']);
 87: 
 88:         return new $class($settings);
 89:     }
 90: 
 91:     /**
 92:      * Remove a single adapter from the registry.
 93:      *
 94:      * @param string $name The adapter name.
 95:      * @return void
 96:      */
 97:     public function unload($name)
 98:     {
 99:         unset($this->_loaded[$name]);
100:     }
101: }
102: 
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