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.7 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.7
      • 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

  • App
  • BasePlugin
  • ClassLoader
  • Configure
  • ObjectRegistry
  • Plugin
  • PluginCollection

Interfaces

  • ConsoleApplicationInterface
  • HttpApplicationInterface
  • PluginApplicationInterface
  • PluginInterface

Traits

  • ConventionsTrait
  • InstanceConfigTrait
  • StaticConfigTrait
  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\Core;
 16: 
 17: use Cake\Utility\Inflector;
 18: 
 19: /**
 20:  * Provides methods that allow other classes access to conventions based inflections.
 21:  */
 22: trait ConventionsTrait
 23: {
 24: 
 25:     /**
 26:      * Creates a fixture name
 27:      *
 28:      * @param string $name Model class name
 29:      * @return string Singular model key
 30:      */
 31:     protected function _fixtureName($name)
 32:     {
 33:         return Inflector::camelize($name);
 34:     }
 35: 
 36:     /**
 37:      * Creates the proper entity name (singular) for the specified name
 38:      *
 39:      * @param string $name Name
 40:      * @return string Camelized and plural model name
 41:      */
 42:     protected function _entityName($name)
 43:     {
 44:         return Inflector::singularize(Inflector::camelize($name));
 45:     }
 46: 
 47:     /**
 48:      * Creates the proper underscored model key for associations
 49:      *
 50:      * If the input contains a dot, assume that the right side is the real table name.
 51:      *
 52:      * @param string $name Model class name
 53:      * @return string Singular model key
 54:      */
 55:     protected function _modelKey($name)
 56:     {
 57:         list(, $name) = pluginSplit($name);
 58: 
 59:         return Inflector::underscore(Inflector::singularize($name)) . '_id';
 60:     }
 61: 
 62:     /**
 63:      * Creates the proper model name from a foreign key
 64:      *
 65:      * @param string $key Foreign key
 66:      * @return string Model name
 67:      */
 68:     protected function _modelNameFromKey($key)
 69:     {
 70:         $key = str_replace('_id', '', $key);
 71: 
 72:         return Inflector::camelize(Inflector::pluralize($key));
 73:     }
 74: 
 75:     /**
 76:      * Creates the singular name for use in views.
 77:      *
 78:      * @param string $name Name to use
 79:      * @return string Variable name
 80:      */
 81:     protected function _singularName($name)
 82:     {
 83:         return Inflector::variable(Inflector::singularize($name));
 84:     }
 85: 
 86:     /**
 87:      * Creates the plural variable name for views
 88:      *
 89:      * @param string $name Name to use
 90:      * @return string Plural name for views
 91:      */
 92:     protected function _variableName($name)
 93:     {
 94:         return Inflector::variable($name);
 95:     }
 96: 
 97:     /**
 98:      * Creates the singular human name used in views
 99:      *
100:      * @param string $name Controller name
101:      * @return string Singular human name
102:      */
103:     protected function _singularHumanName($name)
104:     {
105:         return Inflector::humanize(Inflector::underscore(Inflector::singularize($name)));
106:     }
107: 
108:     /**
109:      * Creates a camelized version of $name
110:      *
111:      * @param string $name name
112:      * @return string Camelized name
113:      */
114:     protected function _camelize($name)
115:     {
116:         return Inflector::camelize($name);
117:     }
118: 
119:     /**
120:      * Creates the plural human name used in views
121:      *
122:      * @param string $name Controller name
123:      * @return string Plural human name
124:      */
125:     protected function _pluralHumanName($name)
126:     {
127:         return Inflector::humanize(Inflector::underscore($name));
128:     }
129: 
130:     /**
131:      * Find the correct path for a plugin. Scans $pluginPaths for the plugin you want.
132:      *
133:      * @param string $pluginName Name of the plugin you want ie. DebugKit
134:      * @return string path path to the correct plugin.
135:      */
136:     protected function _pluginPath($pluginName)
137:     {
138:         if (Plugin::isLoaded($pluginName)) {
139:             return Plugin::path($pluginName);
140:         }
141: 
142:         return current(App::path('Plugin')) . $pluginName . DIRECTORY_SEPARATOR;
143:     }
144: 
145:     /**
146:      * Return plugin's namespace
147:      *
148:      * @param string $pluginName Plugin name
149:      * @return string Plugin's namespace
150:      */
151:     protected function _pluginNamespace($pluginName)
152:     {
153:         return str_replace('/', '\\', $pluginName);
154:     }
155: }
156: 
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