diff --git a/src/Auth/FormAuthenticate.php b/src/Auth/FormAuthenticate.php
index dbea20b7aea..3ae7bb2bf7a 100644
--- a/src/Auth/FormAuthenticate.php
+++ b/src/Auth/FormAuthenticate.php
@@ -48,7 +48,7 @@ class FormAuthenticate extends BaseAuthenticate
protected function _checkFields(ServerRequest $request, array $fields)
{
foreach ([$fields['username'], $fields['password']] as $field) {
- $value = $request->data($field);
+ $value = $request->getData($field);
if (empty($value) || !is_string($value)) {
return false;
}
diff --git a/src/Console/ConsoleOptionParser.php b/src/Console/ConsoleOptionParser.php
index e53482759b0..454f4be8870 100644
--- a/src/Console/ConsoleOptionParser.php
+++ b/src/Console/ConsoleOptionParser.php
@@ -143,7 +143,7 @@ class ConsoleOptionParser
*/
public function __construct($command = null, $defaultOptions = true)
{
- $this->command($command);
+ $this->setCommand($command);
$this->addOption('help', [
'short' => 'h',
@@ -212,10 +212,10 @@ public static function buildFromArray($spec, $defaultOptions = true)
$parser->addSubcommands($spec['subcommands']);
}
if (!empty($spec['description'])) {
- $parser->description($spec['description']);
+ $parser->setDescription($spec['description']);
}
if (!empty($spec['epilog'])) {
- $parser->epilog($spec['epilog']);
+ $parser->setEpilog($spec['epilog']);
}
return $parser;
@@ -261,10 +261,10 @@ public function merge($spec)
$this->addSubcommands($spec['subcommands']);
}
if (!empty($spec['description'])) {
- $this->description($spec['description']);
+ $this->setDescription($spec['description']);
}
if (!empty($spec['epilog'])) {
- $this->epilog($spec['epilog']);
+ $this->setEpilog($spec['epilog']);
}
return $this;
@@ -722,7 +722,7 @@ public function help($subcommand = null, $format = 'text', $width = 72)
$this->_subcommands[$subcommand]->parser() instanceof self
) {
$subparser = $this->_subcommands[$subcommand]->parser();
- $subparser->command($this->command() . ' ' . $subparser->command());
+ $subparser->setCommand($this->getCommand() . ' ' . $subparser->getCommand());
return $subparser->help(null, $format, $width);
}
diff --git a/src/Console/HelpFormatter.php b/src/Console/HelpFormatter.php
index fcf7cf0824c..a9ee9f1903e 100644
--- a/src/Console/HelpFormatter.php
+++ b/src/Console/HelpFormatter.php
@@ -70,7 +70,7 @@ public function text($width = 72)
{
$parser = $this->_parser;
$out = [];
- $description = $parser->description();
+ $description = $parser->getDescription();
if (!empty($description)) {
$out[] = Text::wrap($description, $width);
$out[] = '';
@@ -91,7 +91,7 @@ public function text($width = 72)
]);
}
$out[] = '';
- $out[] = sprintf('To see help on a subcommand use `cake %s [subcommand] --help`', $parser->command());
+ $out[] = sprintf('To see help on a subcommand use `cake %s [subcommand] --help`', $parser->getCommand());
$out[] = '';
}
@@ -124,7 +124,7 @@ public function text($width = 72)
}
$out[] = '';
}
- $epilog = $parser->epilog();
+ $epilog = $parser->getEpilog();
if (!empty($epilog)) {
$out[] = Text::wrap($epilog, $width);
$out[] = '';
@@ -142,7 +142,7 @@ public function text($width = 72)
*/
protected function _generateUsage()
{
- $usage = ['cake ' . $this->_parser->command()];
+ $usage = ['cake ' . $this->_parser->getCommand()];
$subcommands = $this->_parser->subcommands();
if (!empty($subcommands)) {
$usage[] = '[subcommand]';
@@ -193,10 +193,10 @@ public function xml($string = true)
{
$parser = $this->_parser;
$xml = new SimpleXmlElement('');
- $xml->addChild('command', $parser->command());
- $xml->addChild('description', $parser->description());
+ $xml->addChild('command', $parser->getCommand());
+ $xml->addChild('description', $parser->getDescription());
- $xml->addChild('epilog', $parser->epilog());
+ $xml->addChild('epilog', $parser->getEpilog());
$subcommands = $xml->addChild('subcommands');
foreach ($parser->subcommands() as $command) {
$command->xml($subcommands);
diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php
index 03667aa03fb..1a64687cbba 100644
--- a/src/Controller/Controller.php
+++ b/src/Controller/Controller.php
@@ -422,17 +422,17 @@ public function invokeAction()
if (!isset($request)) {
throw new LogicException('No Request object configured. Cannot invoke action');
}
- if (!$this->isAction($request->param('action'))) {
+ if (!$this->isAction($request->getParam('action'))) {
throw new MissingActionException([
'controller' => $this->name . "Controller",
- 'action' => $request->param('action'),
- 'prefix' => $request->param('prefix') ?: '',
- 'plugin' => $request->param('plugin'),
+ 'action' => $request->getParam('action'),
+ 'prefix' => $request->getParam('prefix') ?: '',
+ 'plugin' => $request->getParam('plugin'),
]);
}
- $callable = [$this, $request->param('action')];
+ $callable = [$this, $request->getParam('action')];
- return $callable(...$request->param('pass'));
+ return $callable(...$request->getParam('pass'));
}
/**
@@ -591,12 +591,12 @@ public function setAction($action, ...$args)
public function render($view = null, $layout = null)
{
$builder = $this->viewBuilder();
- if (!$builder->templatePath()) {
- $builder->templatePath($this->_viewPath());
+ if (!$builder->getTemplatePath()) {
+ $builder->setTemplatePath($this->_viewPath());
}
if (!empty($this->request->params['bare'])) {
- $builder->autoLayout(false);
+ $builder->enableAutoLayout(false);
}
$builder->className($this->viewClass);
@@ -610,8 +610,8 @@ public function render($view = null, $layout = null)
return $this->response;
}
- if ($builder->template() === null && $this->request->param('action')) {
- $builder->template($this->request->param('action'));
+ if ($builder->getTemplate() === null && $this->request->getParam('action')) {
+ $builder->setTemplate($this->request->getParam('action'));
}
$this->View = $this->createView();
@@ -628,10 +628,10 @@ public function render($view = null, $layout = null)
protected function _viewPath()
{
$viewPath = $this->name;
- if ($this->request->param('prefix')) {
+ if ($this->request->getParam('prefix')) {
$prefixes = array_map(
'Cake\Utility\Inflector::camelize',
- explode('/', $this->request->param('prefix'))
+ explode('/', $this->request->getParam('prefix'))
);
$viewPath = implode(DIRECTORY_SEPARATOR, $prefixes) . DIRECTORY_SEPARATOR . $viewPath;
}
diff --git a/src/Database/Driver/Mysql.php b/src/Database/Driver/Mysql.php
index beab4f83488..9ba01b835a1 100644
--- a/src/Database/Driver/Mysql.php
+++ b/src/Database/Driver/Mysql.php
@@ -135,7 +135,7 @@ public function prepare($query)
$isObject = $query instanceof Query;
$statement = $this->_connection->prepare($isObject ? $query->sql() : $query);
$result = new MysqlStatement($statement, $this);
- if ($isObject && $query->bufferResults() === false) {
+ if ($isObject && $query->isBufferedResultsEnabled() === false) {
$result->bufferResults(false);
}
diff --git a/src/Database/Driver/Sqlite.php b/src/Database/Driver/Sqlite.php
index 76e27e20b5d..da076230b1f 100644
--- a/src/Database/Driver/Sqlite.php
+++ b/src/Database/Driver/Sqlite.php
@@ -93,7 +93,7 @@ public function prepare($query)
$isObject = $query instanceof Query;
$statement = $this->_connection->prepare($isObject ? $query->sql() : $query);
$result = new SqliteStatement(new PDOStatement($statement, $this), $this);
- if ($isObject && $query->bufferResults() === false) {
+ if ($isObject && $query->isBufferedResultsEnabled() === false) {
$result->bufferResults(false);
}
diff --git a/src/Database/Driver/Sqlserver.php b/src/Database/Driver/Sqlserver.php
index 0fd21ce8ae8..2760fae67cf 100644
--- a/src/Database/Driver/Sqlserver.php
+++ b/src/Database/Driver/Sqlserver.php
@@ -107,7 +107,7 @@ public function prepare($query)
$this->connect();
$options = [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL];
$isObject = $query instanceof Query;
- if ($isObject && $query->bufferResults() === false) {
+ if ($isObject && $query->isBufferedResultsEnabled() === false) {
$options = [];
}
$statement = $this->_connection->prepare($isObject ? $query->sql() : $query, $options);
diff --git a/src/Database/Expression/FunctionExpression.php b/src/Database/Expression/FunctionExpression.php
index bc3f2781638..4351d74abdc 100644
--- a/src/Database/Expression/FunctionExpression.php
+++ b/src/Database/Expression/FunctionExpression.php
@@ -127,7 +127,7 @@ public function name($name = null)
public function add($params, $types = [], $prepend = false)
{
$put = $prepend ? 'array_unshift' : 'array_push';
- $typeMap = $this->typeMap()->types($types);
+ $typeMap = $this->getTypeMap()->setTypes($types);
foreach ($params as $k => $p) {
if ($p === 'literal') {
$put($this->_conditions, $k);
diff --git a/src/Database/Expression/QueryExpression.php b/src/Database/Expression/QueryExpression.php
index 5071cb8dbc5..eba67480581 100644
--- a/src/Database/Expression/QueryExpression.php
+++ b/src/Database/Expression/QueryExpression.php
@@ -64,10 +64,10 @@ class QueryExpression implements ExpressionInterface, Countable
*/
public function __construct($conditions = [], $types = [], $conjunction = 'AND')
{
- $this->typeMap($types);
- $this->tieWith(strtoupper($conjunction));
+ $this->setTypeMap($types);
+ $this->setConjunction(strtoupper($conjunction));
if (!empty($conditions)) {
- $this->add($conditions, $this->typeMap()->types());
+ $this->add($conditions, $this->getTypeMap()->getTypes());
}
}
@@ -124,7 +124,7 @@ public function tieWith($conjunction = null)
*/
public function type($conjunction = null)
{
- return $this->tieWith($conjunction);
+ return $this->setConjunction($conjunction);
}
/**
@@ -450,10 +450,10 @@ public function between($field, $from, $to, $type = null)
public function and_($conditions, $types = [])
{
if ($this->isCallable($conditions)) {
- return $conditions(new self([], $this->typeMap()->types($types)));
+ return $conditions(new self([], $this->getTypeMap()->setTypes($types)));
}
- return new self($conditions, $this->typeMap()->types($types));
+ return new self($conditions, $this->getTypeMap()->setTypes($types));
}
/**
@@ -468,10 +468,10 @@ public function and_($conditions, $types = [])
public function or_($conditions, $types = [])
{
if ($this->isCallable($conditions)) {
- return $conditions(new self([], $this->typeMap()->types($types), 'OR'));
+ return $conditions(new self([], $this->getTypeMap()->setTypes($types), 'OR'));
}
- return new self($conditions, $this->typeMap()->types($types), 'OR');
+ return new self($conditions, $this->getTypeMap()->setTypes($types), 'OR');
}
// @codingStandardsIgnoreEnd
@@ -675,7 +675,7 @@ protected function _addConditions(array $conditions, array $types)
{
$operators = ['and', 'or', 'xor'];
- $typeMap = $this->typeMap()->types($types);
+ $typeMap = $this->getTypeMap()->setTypes($types);
foreach ($conditions as $k => $c) {
$numericKey = is_numeric($k);
@@ -741,7 +741,7 @@ protected function _parseCondition($field, $value)
list($expression, $operator) = $parts;
}
- $type = $this->typeMap()->type($expression);
+ $type = $this->getTypeMap()->type($expression);
$operator = strtolower(trim($operator));
$typeMultiple = strpos($type, '[]') !== false;
@@ -794,7 +794,7 @@ protected function _calculateType($field)
{
$field = $field instanceof IdentifierExpression ? $field->getIdentifier() : $field;
if (is_string($field)) {
- return $this->typeMap()->type($field);
+ return $this->getTypeMap()->type($field);
}
return null;
diff --git a/src/Database/Expression/ValuesExpression.php b/src/Database/Expression/ValuesExpression.php
index 1cdd3c70ec0..25514d4b7e2 100644
--- a/src/Database/Expression/ValuesExpression.php
+++ b/src/Database/Expression/ValuesExpression.php
@@ -73,7 +73,7 @@ class ValuesExpression implements ExpressionInterface
public function __construct(array $columns, $typeMap)
{
$this->_columns = $columns;
- $this->typeMap($typeMap);
+ $this->setTypeMap($typeMap);
}
/**
@@ -94,7 +94,7 @@ public function add($data)
);
}
if ($data instanceof Query) {
- $this->query($data);
+ $this->setQuery($data);
return;
}
@@ -275,7 +275,7 @@ public function sql(ValueBinder $generator)
$placeholders = [];
$types = [];
- $typeMap = $this->typeMap();
+ $typeMap = $this->getTypeMap();
foreach ($defaults as $col => $v) {
$types[$col] = $typeMap->type($col);
}
@@ -300,8 +300,8 @@ public function sql(ValueBinder $generator)
$placeholders[] = implode(', ', $rowPlaceholders);
}
- if ($this->query()) {
- return ' ' . $this->query()->sql($generator);
+ if ($this->getQuery()) {
+ return ' ' . $this->getQuery()->sql($generator);
}
return sprintf(' VALUES (%s)', implode('), (', $placeholders));
@@ -350,7 +350,7 @@ public function traverse(callable $visitor)
protected function _processExpressions()
{
$types = [];
- $typeMap = $this->typeMap();
+ $typeMap = $this->getTypeMap();
$columns = $this->_columnNames();
foreach ($columns as $c) {
diff --git a/src/Database/FunctionsBuilder.php b/src/Database/FunctionsBuilder.php
index dd96e23018d..8b3ac79f45d 100644
--- a/src/Database/FunctionsBuilder.php
+++ b/src/Database/FunctionsBuilder.php
@@ -186,7 +186,7 @@ public function datePart($part, $expression, $types = [])
public function extract($part, $expression, $types = [])
{
$expression = $this->_literalArgumentFunction('EXTRACT', $expression, $types, 'integer');
- $expression->tieWith(' FROM')->add([$part => 'literal'], [], true);
+ $expression->setConjunction(' FROM')->add([$part => 'literal'], [], true);
return $expression;
}
@@ -207,7 +207,7 @@ public function dateAdd($expression, $value, $unit, $types = [])
}
$interval = $value . ' ' . $unit;
$expression = $this->_literalArgumentFunction('DATE_ADD', $expression, $types, 'datetime');
- $expression->tieWith(', INTERVAL')->add([$interval => 'literal']);
+ $expression->setConjunction(', INTERVAL')->add([$interval => 'literal']);
return $expression;
}
diff --git a/src/Database/Query.php b/src/Database/Query.php
index 48f92626e1b..aac8f7fe776 100644
--- a/src/Database/Query.php
+++ b/src/Database/Query.php
@@ -143,7 +143,7 @@ class Query implements ExpressionInterface, IteratorAggregate
*/
public function __construct($connection)
{
- $this->connection($connection);
+ $this->setConnection($connection);
}
/**
@@ -211,7 +211,7 @@ public function execute()
{
$statement = $this->_connection->run($this);
$driver = $this->_connection->driver();
- $typeMap = $this->selectTypeMap();
+ $typeMap = $this->getSelectTypeMap();
if ($typeMap->toArray() && $this->_typeCastAttached === false) {
$this->decorateResults(new FieldTypeConverter($typeMap, $driver));
@@ -247,7 +247,7 @@ public function sql(ValueBinder $generator = null)
$generator->resetCount();
}
- return $this->connection()->compileQuery($this, $generator);
+ return $this->getConnection()->compileQuery($this, $generator);
}
/**
@@ -1370,7 +1370,7 @@ public function insert(array $columns, array $types = [])
$this->_type = 'insert';
$this->_parts['insert'][1] = $columns;
if (!$this->_parts['values']) {
- $this->_parts['values'] = new ValuesExpression($columns, $this->typeMap()->types($types));
+ $this->_parts['values'] = new ValuesExpression($columns, $this->getTypeMap()->setTypes($types));
} else {
$this->_parts['values']->columns($columns);
}
@@ -1484,11 +1484,11 @@ public function update($table)
public function set($key, $value = null, $types = [])
{
if (empty($this->_parts['set'])) {
- $this->_parts['set'] = $this->newExpr()->tieWith(',');
+ $this->_parts['set'] = $this->newExpr()->setConjunction(',');
}
if ($this->_parts['set']->isCallable($key)) {
- $exp = $this->newExpr()->tieWith(',');
+ $exp = $this->newExpr()->setConjunction(',');
$this->_parts['set']->add($key($exp));
return $this;
@@ -1581,7 +1581,7 @@ public function type()
*/
public function newExpr($rawExpression = null)
{
- $expression = new QueryExpression([], $this->typeMap());
+ $expression = new QueryExpression([], $this->getTypeMap());
if ($rawExpression !== null) {
$expression->add($rawExpression);
@@ -1945,11 +1945,11 @@ protected function _conjugate($part, $append, $conjunction, $types)
$append = $append($this->newExpr(), $this);
}
- if ($expression->tieWith() === $conjunction) {
+ if ($expression->getConjunction() === $conjunction) {
$expression->add($append, $types);
} else {
$expression = $this->newExpr()
- ->tieWith($conjunction)
+ ->setConjunction($conjunction)
->add([$append, $expression], $types);
}
@@ -2041,7 +2041,7 @@ public function __debugInfo()
'(help)' => 'This is a Query object, to get the results execute or iterate it.',
'sql' => $sql,
'params' => $params,
- 'defaultTypes' => $this->defaultTypes(),
+ 'defaultTypes' => $this->getDefaultTypes(),
'decorators' => count($this->_resultDecorators),
'executed' => $this->_iterator ? true : false
];
diff --git a/src/Database/QueryCompiler.php b/src/Database/QueryCompiler.php
index 8222066d62f..7b8d4e84bb0 100644
--- a/src/Database/QueryCompiler.php
+++ b/src/Database/QueryCompiler.php
@@ -154,7 +154,7 @@ protected function _sqlCompiler(&$sql, $query, $generator)
*/
protected function _buildSelectPart($parts, $query, $generator)
{
- $driver = $query->connection()->driver();
+ $driver = $query->getConnection()->driver();
$select = 'SELECT%s %s%s';
if ($this->_orderedUnion && $query->clause('union')) {
$select = '(SELECT%s %s%s';
diff --git a/src/Database/Schema/CachedCollection.php b/src/Database/Schema/CachedCollection.php
index e97a666cbf5..fd58c443684 100644
--- a/src/Database/Schema/CachedCollection.php
+++ b/src/Database/Schema/CachedCollection.php
@@ -40,7 +40,7 @@ class CachedCollection extends Collection
public function __construct(ConnectionInterface $connection, $cacheKey = true)
{
parent::__construct($connection);
- $this->cacheMetadata($cacheKey);
+ $this->setCacheMetadata($cacheKey);
}
/**
@@ -50,7 +50,7 @@ public function __construct(ConnectionInterface $connection, $cacheKey = true)
public function describe($name, array $options = [])
{
$options += ['forceRefresh' => false];
- $cacheConfig = $this->cacheMetadata();
+ $cacheConfig = $this->getCacheMetadata();
$cacheKey = $this->cacheKey($name);
if (!empty($cacheConfig) && !$options['forceRefresh']) {
diff --git a/src/Database/Schema/MysqlSchema.php b/src/Database/Schema/MysqlSchema.php
index c67be21779a..e88c5602a47 100644
--- a/src/Database/Schema/MysqlSchema.php
+++ b/src/Database/Schema/MysqlSchema.php
@@ -59,7 +59,7 @@ public function describeOptionsSql($tableName, $config)
*/
public function convertOptionsDescription(TableSchema $schema, $row)
{
- $schema->options([
+ $schema->SetOptions([
'engine' => $row['Engine'],
'collation' => $row['Collation'],
]);
@@ -271,9 +271,9 @@ public function truncateTableSql(TableSchema $schema)
public function createTableSql(TableSchema $schema, $columns, $constraints, $indexes)
{
$content = implode(",\n", array_merge($columns, $constraints, $indexes));
- $temporary = $schema->temporary() ? ' TEMPORARY ' : ' ';
+ $temporary = $schema->isTemporary() ? ' TEMPORARY ' : ' ';
$content = sprintf("CREATE%sTABLE `%s` (\n%s\n)", $temporary, $schema->name(), $content);
- $options = $schema->options();
+ $options = $schema->getOptions();
if (isset($options['engine'])) {
$content .= sprintf(' ENGINE=%s', $options['engine']);
}
diff --git a/src/Database/Schema/PostgresSchema.php b/src/Database/Schema/PostgresSchema.php
index dfd6c7da1d8..e5d820253a0 100644
--- a/src/Database/Schema/PostgresSchema.php
+++ b/src/Database/Schema/PostgresSchema.php
@@ -535,7 +535,7 @@ public function createTableSql(TableSchema $schema, $columns, $constraints, $ind
$content = array_merge($columns, $constraints);
$content = implode(",\n", array_filter($content));
$tableName = $this->_driver->quoteIdentifier($schema->name());
- $temporary = $schema->temporary() ? ' TEMPORARY ' : ' ';
+ $temporary = $schema->isTemporary() ? ' TEMPORARY ' : ' ';
$out = [];
$out[] = sprintf("CREATE%sTABLE %s (\n%s\n)", $temporary, $tableName, $content);
foreach ($indexes as $index) {
diff --git a/src/Database/Schema/SqliteSchema.php b/src/Database/Schema/SqliteSchema.php
index 89d8e87d943..671793aba6c 100644
--- a/src/Database/Schema/SqliteSchema.php
+++ b/src/Database/Schema/SqliteSchema.php
@@ -438,7 +438,7 @@ public function createTableSql(TableSchema $schema, $columns, $constraints, $ind
{
$lines = array_merge($columns, $constraints);
$content = implode(",\n", array_filter($lines));
- $temporary = $schema->temporary() ? ' TEMPORARY ' : ' ';
+ $temporary = $schema->isTemporary() ? ' TEMPORARY ' : ' ';
$table = sprintf("CREATE%sTABLE \"%s\" (\n%s\n)", $temporary, $schema->name(), $content);
$out = [$table];
foreach ($indexes as $index) {
diff --git a/src/Error/BaseErrorHandler.php b/src/Error/BaseErrorHandler.php
index 758dc914e44..c2b81d4ec91 100644
--- a/src/Error/BaseErrorHandler.php
+++ b/src/Error/BaseErrorHandler.php
@@ -327,7 +327,7 @@ protected function _logException(Exception $exception)
*/
protected function _requestContext($request)
{
- $message = "\nRequest URL: " . $request->here();
+ $message = "\nRequest URL: " . $request->getRequestTarget();
$referer = $request->env('HTTP_REFERER');
if ($referer) {
diff --git a/src/Http/Client.php b/src/Http/Client.php
index 09a1b970379..81516506445 100644
--- a/src/Http/Client.php
+++ b/src/Http/Client.php
@@ -372,7 +372,7 @@ protected function _mergeOptions($options)
public function send(Request $request, $options = [])
{
$responses = $this->_adapter->send($request, $options);
- $url = $request->url();
+ $url = $request->getUri();
foreach ($responses as $response) {
$this->_cookies->store($response, $url);
}
diff --git a/src/Mailer/Email.php b/src/Mailer/Email.php
index 63762a6ea80..6f294ea213a 100644
--- a/src/Mailer/Email.php
+++ b/src/Mailer/Email.php
@@ -333,10 +333,10 @@ public function __construct($config = null)
}
$this->viewBuilder()
- ->className('Cake\View\View')
- ->template('')
- ->layout('default')
- ->helpers(['Html']);
+ ->setClassName('Cake\View\View')
+ ->setTemplate('')
+ ->setLayout('default')
+ ->setHelpers(['Html']);
if ($config === null) {
$config = static::config('default');
@@ -881,13 +881,13 @@ public function template($template = false, $layout = false)
{
if ($template === false) {
return [
- 'template' => $this->viewBuilder()->template(),
- 'layout' => $this->viewBuilder()->layout()
+ 'template' => $this->viewBuilder()->getTemplate(),
+ 'layout' => $this->viewBuilder()->getLayout()
];
}
- $this->viewBuilder()->template($template ?: '');
+ $this->viewBuilder()->setTemplate($template ?: '');
if ($layout !== false) {
- $this->viewBuilder()->layout($layout ?: false);
+ $this->viewBuilder()->setLayout($layout ?: false);
}
return $this;
@@ -902,9 +902,9 @@ public function template($template = false, $layout = false)
public function viewRender($viewClass = null)
{
if ($viewClass === null) {
- return $this->viewBuilder()->className();
+ return $this->viewBuilder()->getClassName();
}
- $this->viewBuilder()->className($viewClass);
+ $this->viewBuilder()->setClassName($viewClass);
return $this;
}
@@ -934,9 +934,9 @@ public function viewVars($viewVars = null)
public function theme($theme = null)
{
if ($theme === null) {
- return $this->viewBuilder()->theme();
+ return $this->viewBuilder()->getTheme();
}
- $this->viewBuilder()->theme($theme);
+ $this->viewBuilder()->setTheme($theme);
return $this;
}
@@ -950,9 +950,9 @@ public function theme($theme = null)
public function helpers($helpers = null)
{
if ($helpers === null) {
- return $this->viewBuilder()->helpers();
+ return $this->viewBuilder()->getHelpers();
}
- $this->viewBuilder()->helpers((array)$helpers, false);
+ $this->viewBuilder()->setHelpers((array)$helpers, false);
return $this;
}
@@ -1466,10 +1466,10 @@ protected function _applyConfig($config)
}
if (array_key_exists('helpers', $config)) {
- $this->viewBuilder()->helpers($config['helpers'], false);
+ $this->viewBuilder()->setHelpers($config['helpers'], false);
}
if (array_key_exists('viewRender', $config)) {
- $this->viewBuilder()->className($config['viewRender']);
+ $this->viewBuilder()->setClassName($config['viewRender']);
}
if (array_key_exists('viewVars', $config)) {
$this->set($config['viewVars']);
@@ -1505,12 +1505,12 @@ public function reset()
$this->_profile = [];
$this->_emailPattern = self::EMAIL_PATTERN;
- $this->viewBuilder()->layout('default');
- $this->viewBuilder()->template('');
- $this->viewBuilder()->classname('Cake\View\View');
+ $this->viewBuilder()->setLayout('default');
+ $this->viewBuilder()->setTemplate('');
+ $this->viewBuilder()->setClassname('Cake\View\View');
$this->viewVars = [];
- $this->viewBuilder()->theme(false);
- $this->viewBuilder()->helpers(['Html'], false);
+ $this->viewBuilder()->setTheme(false);
+ $this->viewBuilder()->setHelpers(['Html'], false);
return $this;
}
@@ -1889,7 +1889,7 @@ protected function _renderTemplates($content)
{
$types = $this->_getTypes();
$rendered = [];
- $template = $this->viewBuilder()->template();
+ $template = $this->viewBuilder()->getTemplate();
if (empty($template)) {
foreach ($types as $type) {
$rendered[$type] = $this->_encodeString($content, $this->charset);
diff --git a/src/Mailer/Mailer.php b/src/Mailer/Mailer.php
index 4650f2b2f99..2d345138653 100644
--- a/src/Mailer/Mailer.php
+++ b/src/Mailer/Mailer.php
@@ -178,7 +178,7 @@ public function getName()
*/
public function layout($layout)
{
- $this->_email->viewBuilder()->layout($layout);
+ $this->_email->viewBuilder()->setLayout($layout);
return $this;
}
@@ -241,8 +241,8 @@ public function send($action, $args = [], $headers = [])
}
$this->_email->setHeaders($headers);
- if (!$this->_email->viewBuilder()->template()) {
- $this->_email->viewBuilder()->template($action);
+ if (!$this->_email->viewBuilder()->getTemplate()) {
+ $this->_email->viewBuilder()->setTemplate($action);
}
$this->$action(...$args);
diff --git a/src/Network/Session/DatabaseSession.php b/src/Network/Session/DatabaseSession.php
index 2290f4dca24..7cf643c174e 100644
--- a/src/Network/Session/DatabaseSession.php
+++ b/src/Network/Session/DatabaseSession.php
@@ -95,7 +95,7 @@ public function read($id)
$result = $this->_table
->find('all')
->select(['data'])
- ->where([$this->_table->primaryKey() => $id])
+ ->where([$this->_table->getPrimaryKey() => $id])
->hydrate(false)
->first();
@@ -130,7 +130,7 @@ public function write($id, $data)
}
$expires = time() + $this->_timeout;
$record = compact('data', 'expires');
- $record[$this->_table->primaryKey()] = $id;
+ $record[$this->_table->getPrimaryKey()] = $id;
$result = $this->_table->save(new Entity($record));
return (bool)$result;
@@ -145,7 +145,7 @@ public function write($id, $data)
public function destroy($id)
{
$this->_table->delete(new Entity(
- [$this->_table->primaryKey() => $id],
+ [$this->_table->getPrimaryKey() => $id],
['markNew' => false]
));
diff --git a/src/ORM/Association.php b/src/ORM/Association.php
index ce4175fbbbc..291b953d45a 100644
--- a/src/ORM/Association.php
+++ b/src/ORM/Association.php
@@ -491,8 +491,8 @@ public function getBindingKey()
{
if ($this->_bindingKey === null) {
$this->_bindingKey = $this->isOwningSide($this->source()) ?
- $this->source()->primaryKey() :
- $this->target()->primaryKey();
+ $this->source()->getPrimaryKey() :
+ $this->target()->getPrimaryKey();
}
return $this->_bindingKey;
@@ -686,7 +686,7 @@ public function getProperty()
{
if (!$this->_propertyName) {
$this->_propertyName = $this->_propertyName();
- if (in_array($this->_propertyName, $this->_sourceTable->schema()->columns())) {
+ if (in_array($this->_propertyName, $this->_sourceTable->getSchema()->columns())) {
$msg = 'Association property name "%s" clashes with field of same name of table "%s".' .
' You should explicitly specify the "propertyName" option.';
trigger_error(
@@ -926,7 +926,7 @@ protected function _appendNotMatching($query, $options)
{
$target = $this->_targetTable;
if (!empty($options['negateMatch'])) {
- $primaryKey = $query->aliasFields((array)$target->primaryKey(), $this->_name);
+ $primaryKey = $query->aliasFields((array)$target->getPrimaryKey(), $this->_name);
$query->andWhere(function ($exp) use ($primaryKey) {
array_map([$exp, 'isNull'], $primaryKey);
@@ -1098,7 +1098,7 @@ protected function _dispatchBeforeFind($query)
*/
protected function _appendFields($query, $surrogate, $options)
{
- if ($query->eagerLoader()->autoFields() === false) {
+ if ($query->getEagerLoader()->autoFields() === false) {
return;
}
@@ -1108,12 +1108,12 @@ protected function _appendFields($query, $surrogate, $options)
if (empty($fields) && !$autoFields) {
if ($options['includeFields'] && ($fields === null || $fields !== false)) {
- $fields = $target->schema()->columns();
+ $fields = $target->getSchema()->columns();
}
}
if ($autoFields === true) {
- $fields = array_merge((array)$fields, $target->schema()->columns());
+ $fields = array_merge((array)$fields, $target->getSchema()->columns());
}
if ($fields) {
@@ -1181,7 +1181,7 @@ protected function _formatAssociationResults($query, $surrogate, $options)
*/
protected function _bindNewAssociations($query, $surrogate, $options)
{
- $loader = $surrogate->eagerLoader();
+ $loader = $surrogate->getEagerLoader();
$contain = $loader->contain();
$matching = $loader->matching();
@@ -1194,7 +1194,7 @@ protected function _bindNewAssociations($query, $surrogate, $options)
$newContain[$options['aliasPath'] . '.' . $alias] = $value;
}
- $eagerLoader = $query->eagerLoader();
+ $eagerLoader = $query->getEagerLoader();
$eagerLoader->contain($newContain);
foreach ($matching as $alias => $value) {
diff --git a/src/ORM/Association/BelongsToMany.php b/src/ORM/Association/BelongsToMany.php
index cf20517910e..fc0e8655acc 100644
--- a/src/ORM/Association/BelongsToMany.php
+++ b/src/ORM/Association/BelongsToMany.php
@@ -461,7 +461,7 @@ public function attachTo(Query $query, array $options = [])
'foreignKey' => false,
];
$assoc->attachTo($query, $newOptions);
- $query->eagerLoader()->addToJoinsMap($junction->alias(), $assoc, true);
+ $query->getEagerLoader()->addToJoinsMap($junction->alias(), $assoc, true);
parent::attachTo($query, $options);
@@ -799,7 +799,7 @@ protected function _saveLinks(EntityInterface $sourceEntity, $targetEntities, $o
$belongsTo = $junction->association($target->alias());
$foreignKey = (array)$this->foreignKey();
$assocForeignKey = (array)$belongsTo->foreignKey();
- $targetPrimaryKey = (array)$target->primaryKey();
+ $targetPrimaryKey = (array)$target->getPrimaryKey();
$bindingKey = (array)$this->bindingKey();
$jointProperty = $this->_junctionProperty;
$junctionAlias = $junction->alias();
@@ -1273,7 +1273,7 @@ protected function _diffLinks($existing, $jointEntities, $targetEntities, $optio
}
}
- $primary = (array)$target->primaryKey();
+ $primary = (array)$target->getPrimaryKey();
$jointProperty = $this->_junctionProperty;
foreach ($targetEntities as $k => $entity) {
if (!($entity instanceof EntityInterface)) {
@@ -1342,7 +1342,7 @@ protected function _collectJointEntities($sourceEntity, $targetEntities)
$source = $this->source();
$junction = $this->junction();
$jointProperty = $this->_junctionProperty;
- $primary = (array)$target->primaryKey();
+ $primary = (array)$target->getPrimaryKey();
$result = [];
$missing = [];
@@ -1369,7 +1369,7 @@ protected function _collectJointEntities($sourceEntity, $targetEntities)
$hasMany = $source->association($junction->alias());
$foreignKey = (array)$this->foreignKey();
$assocForeignKey = (array)$belongsTo->foreignKey();
- $sourceKey = $sourceEntity->extract((array)$source->primaryKey());
+ $sourceKey = $sourceEntity->extract((array)$source->getPrimaryKey());
foreach ($missing as $key) {
$unions[] = $hasMany->find('all')
diff --git a/src/ORM/Association/HasMany.php b/src/ORM/Association/HasMany.php
index 2146f7ff1c3..534316f2123 100644
--- a/src/ORM/Association/HasMany.php
+++ b/src/ORM/Association/HasMany.php
@@ -332,7 +332,7 @@ public function unlink(EntityInterface $sourceEntity, array $targetEntities, $op
$foreignKey = (array)$this->foreignKey();
$target = $this->target();
- $targetPrimaryKey = array_merge((array)$target->primaryKey(), $foreignKey);
+ $targetPrimaryKey = array_merge((array)$target->getPrimaryKey(), $foreignKey);
$property = $this->property();
$conditions = [
@@ -435,7 +435,7 @@ public function replace(EntityInterface $sourceEntity, array $targetEntities, ar
*/
protected function _unlinkAssociated(array $properties, EntityInterface $entity, Table $target, array $remainingEntities = [], array $options = [])
{
- $primaryKey = (array)$target->primaryKey();
+ $primaryKey = (array)$target->getPrimaryKey();
$exclusions = new Collection($remainingEntities);
$exclusions = $exclusions->map(
function ($ent) use ($primaryKey) {
@@ -520,7 +520,7 @@ protected function _foreignKeyAcceptsNull(Table $table, array $properties)
false,
array_map(
function ($prop) use ($table) {
- return $table->schema()->isNullable($prop);
+ return $table->getSchema()->isNullable($prop);
},
$properties
)
diff --git a/src/ORM/Association/HasOne.php b/src/ORM/Association/HasOne.php
index 4ee4fddde19..36a34b7fda9 100644
--- a/src/ORM/Association/HasOne.php
+++ b/src/ORM/Association/HasOne.php
@@ -49,7 +49,7 @@ class HasOne extends Association
public function getForeignKey()
{
if ($this->_foreignKey === null) {
- $this->_foreignKey = $this->_modelKey($this->source()->alias());
+ $this->_foreignKey = $this->_modelKey($this->getSource()->getAlias());
}
return $this->_foreignKey;
@@ -94,7 +94,7 @@ protected function _propertyName()
*/
public function isOwningSide(Table $side)
{
- return $side === $this->source();
+ return $side === $this->getSource();
}
/**
@@ -150,12 +150,12 @@ public function saveAssociated(EntityInterface $entity, array $options = [])
public function eagerLoader(array $options)
{
$loader = new SelectLoader([
- 'alias' => $this->alias(),
- 'sourceAlias' => $this->source()->alias(),
- 'targetAlias' => $this->target()->alias(),
- 'foreignKey' => $this->foreignKey(),
- 'bindingKey' => $this->bindingKey(),
- 'strategy' => $this->strategy(),
+ 'alias' => $this->getAlias(),
+ 'sourceAlias' => $this->getSource()->getAlias(),
+ 'targetAlias' => $this->getTarget()->getAlias(),
+ 'foreignKey' => $this->getForeignKey(),
+ 'bindingKey' => $this->getBindingKey(),
+ 'strategy' => $this->getStrategy(),
'associationType' => $this->type(),
'finder' => [$this, 'find']
]);
diff --git a/src/ORM/Association/Loader/SelectWithPivotLoader.php b/src/ORM/Association/Loader/SelectWithPivotLoader.php
index f9ec121f57f..41b6ec405b9 100644
--- a/src/ORM/Association/Loader/SelectWithPivotLoader.php
+++ b/src/ORM/Association/Loader/SelectWithPivotLoader.php
@@ -102,7 +102,7 @@ protected function _buildQuery($options)
// and that the required keys are in the selected columns.
$tempName = $this->alias . '_CJoin';
- $schema = $assoc->schema();
+ $schema = $assoc->getSchema();
$joinFields = $types = [];
foreach ($schema->typeMap() as $f => $type) {
@@ -116,15 +116,15 @@ protected function _buildQuery($options)
->select($joinFields);
$query
- ->eagerLoader()
+ ->getEagerLoader()
->addToJoinsMap($tempName, $assoc, false, $this->junctionProperty);
$assoc->attachTo($query, [
- 'aliasPath' => $assoc->alias(),
+ 'aliasPath' => $assoc->getAlias(),
'includeFields' => false,
'propertyPath' => $this->junctionProperty,
]);
- $query->typeMap()->addDefaults($types);
+ $query->getTypeMap()->addDefaults($types);
return $query;
}
diff --git a/src/ORM/Behavior/TranslateBehavior.php b/src/ORM/Behavior/TranslateBehavior.php
index 51eb078a3cc..34c88f078a7 100644
--- a/src/ORM/Behavior/TranslateBehavior.php
+++ b/src/ORM/Behavior/TranslateBehavior.php
@@ -290,7 +290,7 @@ public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $o
return;
}
- $primaryKey = (array)$this->_table->primaryKey();
+ $primaryKey = (array)$this->_table->getPrimaryKey();
$key = $entity->get(current($primaryKey));
// When we have no key and bundled translations, we
@@ -572,7 +572,7 @@ protected function _bundleTranslatedFields($entity)
}
$fields = $this->_config['fields'];
- $primaryKey = (array)$this->_table->primaryKey();
+ $primaryKey = (array)$this->_table->getPrimaryKey();
$key = $entity->get(current($primaryKey));
$find = [];
diff --git a/src/ORM/Behavior/TreeBehavior.php b/src/ORM/Behavior/TreeBehavior.php
index 1fb89664771..87f9fabd300 100644
--- a/src/ORM/Behavior/TreeBehavior.php
+++ b/src/ORM/Behavior/TreeBehavior.php
@@ -966,7 +966,7 @@ protected function _ensureFields($entity)
protected function _getPrimaryKey()
{
if (!$this->_primaryKey) {
- $primaryKey = (array)$this->_table->primaryKey();
+ $primaryKey = (array)$this->_table->getPrimaryKey();
$this->_primaryKey = $primaryKey[0];
}
diff --git a/src/ORM/LazyEagerLoader.php b/src/ORM/LazyEagerLoader.php
index a7bc4d2c3eb..395e360f12c 100644
--- a/src/ORM/LazyEagerLoader.php
+++ b/src/ORM/LazyEagerLoader.php
@@ -69,7 +69,7 @@ public function loadInto($entities, array $contain, Table $source)
*/
protected function _getQuery($objects, $contain, $source)
{
- $primaryKey = $source->primaryKey();
+ $primaryKey = $source->getPrimaryKey();
$method = is_string($primaryKey) ? 'get' : 'extract';
$keys = $objects->map(function ($entity) use ($primaryKey, $method) {
@@ -95,7 +95,7 @@ protected function _getQuery($objects, $contain, $source)
})
->contain($contain);
- foreach ($query->eagerLoader()->attachableAssociations($source) as $loadable) {
+ foreach ($query->getEagerLoader()->attachableAssociations($source) as $loadable) {
$config = $loadable->config();
$config['includeFields'] = true;
$loadable->config($config);
@@ -137,7 +137,7 @@ protected function _injectResults($objects, $results, $associations, $source)
{
$injected = [];
$properties = $this->_getPropertyMap($source, $associations);
- $primaryKey = (array)$source->primaryKey();
+ $primaryKey = (array)$source->getPrimaryKey();
$results = $results
->indexBy(function ($e) use ($primaryKey) {
return implode(';', $e->extract($primaryKey));
diff --git a/src/ORM/Marshaller.php b/src/ORM/Marshaller.php
index 257bb3ecbcc..72ff399a8dd 100644
--- a/src/ORM/Marshaller.php
+++ b/src/ORM/Marshaller.php
@@ -65,7 +65,7 @@ public function __construct(Table $table)
protected function _buildPropertyMap($data, $options)
{
$map = [];
- $schema = $this->_table->schema();
+ $schema = $this->_table->getSchema();
// Is a concrete column?
foreach (array_keys($data) as $prop) {
@@ -166,7 +166,7 @@ public function one(array $data, array $options = [])
{
list($data, $options) = $this->_prepareDataAndOptions($data, $options);
- $primaryKey = (array)$this->_table->primaryKey();
+ $primaryKey = (array)$this->_table->getPrimaryKey();
$entityClass = $this->_table->entityClass();
/* @var Entity $entity */
$entity = new $entityClass();
@@ -364,7 +364,7 @@ protected function _belongsToMany(Association $assoc, array $data, $options = []
$data = array_values($data);
$target = $assoc->target();
- $primaryKey = array_flip((array)$target->primaryKey());
+ $primaryKey = array_flip((array)$target->getPrimaryKey());
$records = $conditions = [];
$primaryCount = count($primaryKey);
$conditions = [];
@@ -454,7 +454,7 @@ protected function _loadAssociatedByIds($assoc, $ids)
}
$target = $assoc->target();
- $primaryKey = (array)$target->primaryKey();
+ $primaryKey = (array)$target->getPrimaryKey();
$multi = count($primaryKey) > 1;
$primaryKey = array_map([$target, 'aliasField'], $primaryKey);
@@ -529,7 +529,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
$keys = [];
if (!$isNew) {
- $keys = $entity->extract((array)$this->_table->primaryKey());
+ $keys = $entity->extract((array)$this->_table->getPrimaryKey());
}
if (isset($options['accessibleFields'])) {
@@ -539,7 +539,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
}
$errors = $this->_validate($data + $keys, $options, $isNew);
- $schema = $this->_table->schema();
+ $schema = $this->_table->getSchema();
$options['isMerge'] = true;
$propertyMap = $this->_buildPropertyMap($data, $options);
$properties = $marshalledAssocs = [];
@@ -628,7 +628,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
*/
public function mergeMany($entities, array $data, array $options = [])
{
- $primary = (array)$this->_table->primaryKey();
+ $primary = (array)$this->_table->getPrimaryKey();
$indexed = (new Collection($data))
->groupBy(function ($el) use ($primary) {
diff --git a/src/ORM/Query.php b/src/ORM/Query.php
index 0e19ab778b5..b4626828fe4 100644
--- a/src/ORM/Query.php
+++ b/src/ORM/Query.php
@@ -187,7 +187,7 @@ public function select($fields = [], $overwrite = false)
}
if ($fields instanceof Table) {
- $fields = $this->aliasFields($fields->schema()->columns(), $fields->alias());
+ $fields = $this->aliasFields($fields->getSchema()->columns(), $fields->alias());
}
return parent::select($fields, $overwrite);
@@ -207,7 +207,7 @@ public function select($fields = [], $overwrite = false)
public function addDefaultTypes(Table $table)
{
$alias = $table->alias();
- $map = $table->schema()->typeMap();
+ $map = $table->getSchema()->typeMap();
$fields = [];
foreach ($map as $f => $type) {
$fields[$f] = $fields[$alias . '.' . $f] = $fields[$alias . '__' . $f] = $type;
@@ -377,7 +377,7 @@ public function eagerLoader(EagerLoader $instance = null)
*/
public function contain($associations = null, $override = false)
{
- $loader = $this->eagerLoader();
+ $loader = $this->getEagerLoader();
if ($override === true) {
$loader->clearContain();
$this->_dirty();
@@ -411,7 +411,7 @@ protected function _addAssociationsToTypeMap($table, $typeMap, $associations)
continue;
}
$target = $association->target();
- $primary = (array)$target->primaryKey();
+ $primary = (array)$target->getPrimaryKey();
if (empty($primary) || $typeMap->type($target->aliasField($primary[0])) === null) {
$this->addDefaultTypes($target);
}
@@ -473,7 +473,7 @@ protected function _addAssociationsToTypeMap($table, $typeMap, $associations)
*/
public function matching($assoc, callable $builder = null)
{
- $result = $this->eagerLoader()->matching($assoc, $builder);
+ $result = $this->getEagerLoader()->matching($assoc, $builder);
$this->_addAssociationsToTypeMap($this->repository(), $this->typeMap(), $result);
$this->_dirty();
@@ -545,7 +545,7 @@ public function matching($assoc, callable $builder = null)
*/
public function leftJoinWith($assoc, callable $builder = null)
{
- $result = $this->eagerLoader()->matching($assoc, $builder, [
+ $result = $this->getEagerLoader()->matching($assoc, $builder, [
'joinType' => 'LEFT',
'fields' => false
]);
@@ -592,7 +592,7 @@ public function leftJoinWith($assoc, callable $builder = null)
*/
public function innerJoinWith($assoc, callable $builder = null)
{
- $result = $this->eagerLoader()->matching($assoc, $builder, [
+ $result = $this->getEagerLoader()->matching($assoc, $builder, [
'joinType' => 'INNER',
'fields' => false
]);
@@ -654,7 +654,7 @@ public function innerJoinWith($assoc, callable $builder = null)
*/
public function notMatching($assoc, callable $builder = null)
{
- $result = $this->eagerLoader()->matching($assoc, $builder, [
+ $result = $this->getEagerLoader()->matching($assoc, $builder, [
'joinType' => 'LEFT',
'fields' => false,
'negateMatch' => true
@@ -834,7 +834,7 @@ protected function _performCount()
$count = ['count' => $query->func()->count('*')];
if (!$complex) {
- $query->eagerLoader()->autoFields(false);
+ $query->getEagerLoader()->autoFields(false);
$statement = $query
->select($count, true)
->autoFields(false)
@@ -978,7 +978,7 @@ protected function _execute()
return new $decorator($this->_results);
}
- $statement = $this->eagerLoader()->loadExternal($this, $this->execute());
+ $statement = $this->getEagerLoader()->loadExternal($this, $this->execute());
return new ResultSet($this, $statement);
}
@@ -1005,7 +1005,7 @@ protected function _transformQuery()
$this->from([$this->_repository->alias() => $this->_repository->table()]);
}
$this->_addDefaultFields();
- $this->eagerLoader()->attachAssociations($this, $this->_repository, !$this->_hasFields);
+ $this->getEagerLoader()->attachAssociations($this, $this->_repository, !$this->_hasFields);
$this->_addDefaultSelectTypes();
}
@@ -1022,7 +1022,7 @@ protected function _addDefaultFields()
if (!count($select) || $this->_autoFields === true) {
$this->_hasFields = false;
- $this->select($this->repository()->schema()->columns());
+ $this->select($this->repository()->getSchema()->columns());
$select = $this->clause('select');
}
@@ -1154,7 +1154,7 @@ public function __call($method, $arguments)
*/
public function __debugInfo()
{
- $eagerLoader = $this->eagerLoader();
+ $eagerLoader = $this->getEagerLoader();
return parent::__debugInfo() + [
'hydrate' => $this->_hydrate,
diff --git a/src/ORM/ResultSet.php b/src/ORM/ResultSet.php
index 48f90f18ca8..b0e85cece29 100644
--- a/src/ORM/ResultSet.php
+++ b/src/ORM/ResultSet.php
@@ -363,7 +363,7 @@ public function count()
*/
protected function _calculateAssociationMap($query)
{
- $map = $query->eagerLoader()->associationsMap($this->_defaultTable);
+ $map = $query->getEagerLoader()->associationsMap($this->_defaultTable);
$this->_matchingMap = (new Collection($map))
->match(['matching' => true])
->indexBy('alias')
@@ -430,7 +430,7 @@ protected function _calculateTypeMap()
protected function _getTypes($table, $fields)
{
$types = [];
- $schema = $table->schema();
+ $schema = $table->getSchema();
$map = array_keys(Type::map() + ['string' => 1, 'text' => 1, 'boolean' => 1]);
$typeMap = array_combine(
$map,
diff --git a/src/ORM/Rule/ExistsIn.php b/src/ORM/Rule/ExistsIn.php
index b6a42573927..7c854a5dbaf 100644
--- a/src/ORM/Rule/ExistsIn.php
+++ b/src/ORM/Rule/ExistsIn.php
@@ -92,7 +92,7 @@ public function __invoke(EntityInterface $entity, array $options)
$source = $target = $this->_repository;
$isAssociation = $target instanceof Association;
- $bindingKey = $isAssociation ? (array)$target->bindingKey() : (array)$target->primaryKey();
+ $bindingKey = $isAssociation ? (array)$target->bindingKey() : (array)$target->getPrimaryKey();
$realTarget = $isAssociation ? $target->target() : $target;
if (!empty($options['_sourceTable']) && $realTarget === $options['_sourceTable']) {
@@ -115,7 +115,7 @@ public function __invoke(EntityInterface $entity, array $options)
}
if ($this->_options['allowNullableNulls']) {
- $schema = $source->schema();
+ $schema = $source->getSchema();
foreach ($this->_fields as $i => $field) {
if ($schema->column($field) && $schema->isNullable($field) && $entity->get($field) === null) {
unset($bindingKey[$i]);
@@ -146,7 +146,7 @@ public function __invoke(EntityInterface $entity, array $options)
protected function _fieldsAreNull($entity, $source)
{
$nulls = 0;
- $schema = $source->schema();
+ $schema = $source->getSchema();
foreach ($this->_fields as $field) {
if ($schema->column($field) && $schema->isNullable($field) && $entity->get($field) === null) {
$nulls++;
diff --git a/src/ORM/Rule/IsUnique.php b/src/ORM/Rule/IsUnique.php
index 5c64b434fdc..b28ed9d2f3d 100644
--- a/src/ORM/Rule/IsUnique.php
+++ b/src/ORM/Rule/IsUnique.php
@@ -72,7 +72,7 @@ public function __invoke(EntityInterface $entity, array $options)
$alias = $options['repository']->alias();
$conditions = $this->_alias($alias, $entity->extract($this->_fields), $allowMultipleNulls);
if ($entity->isNew() === false) {
- $keys = (array)$options['repository']->primaryKey();
+ $keys = (array)$options['repository']->getPrimaryKey();
$keys = $this->_alias($alias, $entity->extract($keys), $allowMultipleNulls);
if (array_filter($keys, 'strlen')) {
$conditions['NOT'] = $keys;
diff --git a/src/ORM/Table.php b/src/ORM/Table.php
index 0a5d2118219..885dcf2aed3 100644
--- a/src/ORM/Table.php
+++ b/src/ORM/Table.php
@@ -698,8 +698,8 @@ public function setDisplayField($key)
public function getDisplayField()
{
if ($this->_displayField === null) {
- $schema = $this->schema();
- $primary = (array)$this->primaryKey();
+ $schema = $this->getSchema();
+ $primary = (array)$this->getPrimaryKey();
$this->_displayField = array_shift($primary);
if ($schema->column('title')) {
$this->_displayField = 'title';
@@ -1251,7 +1251,7 @@ public function findAll(Query $query, array $options)
public function findList(Query $query, array $options)
{
$options += [
- 'keyField' => $this->primaryKey(),
+ 'keyField' => $this->getPrimaryKey(),
'valueField' => $this->displayField(),
'groupField' => null
];
@@ -1272,7 +1272,7 @@ public function findList(Query $query, array $options)
(array)$options['valueField'],
(array)$options['groupField']
);
- $columns = $this->schema()->columns();
+ $columns = $this->getSchema()->columns();
if (count($fields) === count(array_intersect($fields, $columns))) {
$query->select($fields);
}
@@ -1319,7 +1319,7 @@ public function findList(Query $query, array $options)
public function findThreaded(Query $query, array $options)
{
$options += [
- 'keyField' => $this->primaryKey(),
+ 'keyField' => $this->getPrimaryKey(),
'parentField' => 'parent_id',
'nestingKey' => 'children'
];
@@ -1392,7 +1392,7 @@ protected function _setFieldMatchers($options, $keys)
*/
public function get($primaryKey, $options = [])
{
- $key = (array)$this->primaryKey();
+ $key = (array)$this->getPrimaryKey();
$alias = $this->alias();
foreach ($key as $index => $keyname) {
$key[$index] = $alias . '.' . $keyname;
@@ -1751,7 +1751,7 @@ public function save(EntityInterface $entity, $options = [])
*/
protected function _processSave($entity, $options)
{
- $primaryColumns = (array)$this->primaryKey();
+ $primaryColumns = (array)$this->getPrimaryKey();
if ($options['checkExisting'] && $primaryColumns && $entity->isNew() && $entity->has($primaryColumns)) {
$alias = $this->alias();
@@ -1785,7 +1785,7 @@ protected function _processSave($entity, $options)
return false;
}
- $data = $entity->extract($this->schema()->columns(), true);
+ $data = $entity->extract($this->getSchema()->columns(), true);
$isNew = $entity->isNew();
if ($isNew) {
@@ -1799,7 +1799,7 @@ protected function _processSave($entity, $options)
}
if (!$success && $isNew) {
- $entity->unsetProperty($this->primaryKey());
+ $entity->unsetProperty($this->getPrimaryKey());
$entity->isNew(true);
}
@@ -1855,7 +1855,7 @@ protected function _onSaveSuccess($entity, $options)
*/
protected function _insert($entity, $data)
{
- $primary = (array)$this->primaryKey();
+ $primary = (array)$this->getPrimaryKey();
if (empty($primary)) {
$msg = sprintf(
'Cannot insert row in "%s" table, it has no primary key.',
@@ -1874,7 +1874,7 @@ protected function _insert($entity, $data)
$data = $data + $filteredKeys;
if (count($primary) > 1) {
- $schema = $this->schema();
+ $schema = $this->getSchema();
foreach ($primary as $k => $v) {
if (!isset($data[$k]) && empty($schema->column($k)['autoIncrement'])) {
$msg = 'Cannot insert row, some of the primary key values are missing. ';
@@ -1900,7 +1900,7 @@ protected function _insert($entity, $data)
if ($statement->rowCount() !== 0) {
$success = $entity;
$entity->set($filteredKeys, ['guard' => false]);
- $schema = $this->schema();
+ $schema = $this->getSchema();
$driver = $this->connection()->driver();
foreach ($primary as $key => $v) {
if (!isset($data[$key])) {
@@ -1931,7 +1931,7 @@ protected function _newId($primary)
if (!$primary || count((array)$primary) > 1) {
return null;
}
- $typeName = $this->schema()->columnType($primary[0]);
+ $typeName = $this->getSchema()->columnType($primary[0]);
$type = Type::build($typeName);
return $type->newId();
@@ -1947,7 +1947,7 @@ protected function _newId($primary)
*/
protected function _update($entity, $data)
{
- $primaryColumns = (array)$this->primaryKey();
+ $primaryColumns = (array)$this->getPrimaryKey();
$primaryKey = $entity->extract($primaryColumns);
$data = array_diff_key($data, $primaryKey);
@@ -2005,7 +2005,7 @@ function () use ($entities, $options, &$isNew) {
if ($return === false) {
foreach ($entities as $key => $entity) {
if (isset($isNew[$key]) && $isNew[$key]) {
- $entity->unsetProperty($this->primaryKey());
+ $entity->unsetProperty($this->getPrimaryKey());
$entity->isNew(true);
}
}
@@ -2083,7 +2083,7 @@ protected function _processDelete($entity, $options)
return false;
}
- $primaryKey = (array)$this->primaryKey();
+ $primaryKey = (array)$this->getPrimaryKey();
if (!$entity->has($primaryKey)) {
$msg = 'Deleting requires all primary key values.';
throw new InvalidArgumentException($msg);
diff --git a/src/Shell/I18nShell.php b/src/Shell/I18nShell.php
index 757e27b706a..4bf366ea8e0 100644
--- a/src/Shell/I18nShell.php
+++ b/src/Shell/I18nShell.php
@@ -82,7 +82,7 @@ public function init($language = null)
$language = $this->in('Please specify language code, e.g. `en`, `eng`, `en_US` etc.');
}
if (strlen($language) < 2) {
- return $this->error('Invalid language code. Valid is `en`, `eng`, `en_US` etc.');
+ return $this->abort('Invalid language code. Valid is `en`, `eng`, `en_US` etc.');
}
$this->_paths = [APP];
diff --git a/src/Shell/PluginShell.php b/src/Shell/PluginShell.php
index 378fe03a04d..efb0b63b23f 100644
--- a/src/Shell/PluginShell.php
+++ b/src/Shell/PluginShell.php
@@ -54,7 +54,7 @@ public function getOptionParser()
{
$parser = parent::getOptionParser();
- $parser->description('Plugin Shell perform various tasks related to plugin.')
+ $parser->setDescription('Plugin Shell perform various tasks related to plugin.')
->addSubcommand('assets', [
'help' => 'Symlink / copy plugin assets to app\'s webroot',
'parser' => $this->Assets->getOptionParser()
diff --git a/src/Shell/Task/ExtractTask.php b/src/Shell/Task/ExtractTask.php
index ffdd7fda875..e944bbdce97 100644
--- a/src/Shell/Task/ExtractTask.php
+++ b/src/Shell/Task/ExtractTask.php
@@ -311,7 +311,7 @@ protected function _extract()
public function getOptionParser()
{
$parser = parent::getOptionParser();
- $parser->description(
+ $parser->setDescription(
'CakePHP Language String Extraction:'
)->addOption('app', [
'help' => 'Directory where your application is located.'
diff --git a/src/View/Form/ArrayContext.php b/src/View/Form/ArrayContext.php
index a63287b32bc..e95910d7537 100644
--- a/src/View/Form/ArrayContext.php
+++ b/src/View/Form/ArrayContext.php
@@ -166,7 +166,7 @@ public function val($field, $options = [])
'schemaDefault' => true
];
- $val = $this->_request->data($field);
+ $val = $this->_request->getData($field);
if ($val !== null) {
return $val;
}
diff --git a/src/View/Form/EntityContext.php b/src/View/Form/EntityContext.php
index 2b3dbe29817..08a92b1b12e 100644
--- a/src/View/Form/EntityContext.php
+++ b/src/View/Form/EntityContext.php
@@ -155,7 +155,7 @@ protected function _prepare()
is_array($entity) ||
$entity instanceof Traversable
);
- $alias = $this->_rootName = $table->alias();
+ $alias = $this->_rootName = $table->getAlias();
$this->_tables[$alias] = $table;
}
@@ -168,7 +168,7 @@ protected function _prepare()
*/
public function primaryKey()
{
- return (array)$this->_tables[$this->_rootName]->primaryKey();
+ return (array)$this->_tables[$this->_rootName]->getPrimaryKey();
}
/**
@@ -178,7 +178,7 @@ public function isPrimaryKey($field)
{
$parts = explode('.', $field);
$table = $this->_getTable($parts);
- $primaryKey = (array)$table->primaryKey();
+ $primaryKey = (array)$table->getPrimaryKey();
return in_array(array_pop($parts), $primaryKey);
}
@@ -230,7 +230,7 @@ public function val($field, $options = [])
'schemaDefault' => true
];
- $val = $this->_request->data($field);
+ $val = $this->_request->getData($field);
if ($val !== null) {
return $val;
}
@@ -281,7 +281,7 @@ protected function _schemaDefault($field, $entity)
if ($table === false) {
return null;
}
- $defaults = $table->schema()->defaultValues();
+ $defaults = $table->getSchema()->defaultValues();
if (!array_key_exists($field, $defaults)) {
return null;
}
@@ -303,7 +303,7 @@ protected function _extractMultiple($values, $path)
return null;
}
$table = $this->_getTable($path, false);
- $primary = $table ? (array)$table->primaryKey() : ['id'];
+ $primary = $table ? (array)$table->getPrimaryKey() : ['id'];
return (new Collection($values))->extract($primary[0])->toArray();
}
@@ -433,7 +433,7 @@ public function fieldNames()
{
$table = $this->_getTable('0');
- return $table->schema()->columns();
+ return $table->getSchema()->columns();
}
/**
@@ -452,13 +452,13 @@ protected function _getValidator($parts)
$entity = $this->entity($parts) ?: null;
if (isset($this->_validator[$key])) {
- $this->_validator[$key]->provider('entity', $entity);
+ $this->_validator[$key]->setProvider('entity', $entity);
return $this->_validator[$key];
}
$table = $this->_getTable($parts);
- $alias = $table->alias();
+ $alias = $table->getAlias();
$method = 'default';
if (is_string($this->_context['validator'])) {
@@ -468,7 +468,7 @@ protected function _getValidator($parts)
}
$validator = $table->validator($method);
- $validator->provider('entity', $entity);
+ $validator->setProvider('entity', $entity);
return $this->_validator[$key] = $validator;
}
@@ -527,7 +527,7 @@ public function type($field)
$parts = explode('.', $field);
$table = $this->_getTable($parts);
- return $table->schema()->baseColumnType(array_pop($parts));
+ return $table->getSchema()->baseColumnType(array_pop($parts));
}
/**
@@ -540,7 +540,7 @@ public function attributes($field)
{
$parts = explode('.', $field);
$table = $this->_getTable($parts);
- $column = (array)$table->schema()->column(array_pop($parts));
+ $column = (array)$table->getSchema()->column(array_pop($parts));
$whitelist = ['length' => null, 'precision' => null];
return array_intersect_key($column, $whitelist);
diff --git a/src/View/Form/FormContext.php b/src/View/Form/FormContext.php
index 3a636899c0b..0ca86641d7a 100644
--- a/src/View/Form/FormContext.php
+++ b/src/View/Form/FormContext.php
@@ -89,7 +89,7 @@ public function val($field, $options = [])
'schemaDefault' => true
];
- $val = $this->_request->data($field);
+ $val = $this->_request->getData($field);
if ($val !== null) {
return $val;
}
diff --git a/src/View/Form/NullContext.php b/src/View/Form/NullContext.php
index 6a3afe56e3a..28b18cc7f57 100644
--- a/src/View/Form/NullContext.php
+++ b/src/View/Form/NullContext.php
@@ -72,7 +72,7 @@ public function isCreate()
*/
public function val($field)
{
- return $this->_request->data($field);
+ return $this->_request->getData($field);
}
/**
diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php
index 4524d977bbe..aefcd4205bf 100644
--- a/src/View/Helper/FormHelper.php
+++ b/src/View/Helper/FormHelper.php
@@ -467,8 +467,8 @@ protected function _formUrl($context, $options)
$actionDefaults = [
'plugin' => $this->plugin,
- 'controller' => $this->request->param('controller'),
- 'action' => $this->request->param('action'),
+ 'controller' => $this->request->getParam('controller'),
+ 'action' => $this->request->getParam('action'),
];
$action = (array)$options['url'] + $actionDefaults;
@@ -507,17 +507,17 @@ protected function _lastAction($url)
*/
protected function _csrfField()
{
- if ($this->request->param('_Token.unlockedFields')) {
- foreach ((array)$this->request->param('_Token.unlockedFields') as $unlocked) {
+ if ($this->request->getParam('_Token.unlockedFields')) {
+ foreach ((array)$this->request->getParam('_Token.unlockedFields') as $unlocked) {
$this->_unlockedFields[] = $unlocked;
}
}
- if (!$this->request->param('_csrfToken')) {
+ if (!$this->request->getParam('_csrfToken')) {
return '';
}
return $this->hidden('_csrfToken', [
- 'value' => $this->request->param('_csrfToken'),
+ 'value' => $this->request->getParam('_csrfToken'),
'secure' => static::SECURE_SKIP
]);
}
@@ -537,7 +537,7 @@ public function end(array $secureAttributes = [])
{
$out = '';
- if ($this->requestType !== 'get' && $this->request->param('_Token')) {
+ if ($this->requestType !== 'get' && $this->request->getParam('_Token')) {
$out .= $this->secure($this->fields, $secureAttributes);
$this->fields = [];
$this->_unlockedFields = [];
@@ -570,7 +570,7 @@ public function end(array $secureAttributes = [])
*/
public function secure(array $fields = [], array $secureAttributes = [])
{
- if (!$this->request->param('_Token')) {
+ if (!$this->request->getParam('_Token')) {
return '';
}
$debugSecurity = Configure::read('debug');
@@ -1010,7 +1010,7 @@ public function fieldset($fields = '', array $options = [])
if (!$isCreate) {
$actionName = __d('cake', 'Edit %s');
}
- $modelName = Inflector::humanize(Inflector::singularize($this->request->param('controller')));
+ $modelName = Inflector::humanize(Inflector::singularize($this->request->getParam('controller')));
$legend = sprintf($actionName, $modelName);
}
@@ -2503,7 +2503,7 @@ public function date($fieldName, array $options = [])
protected function _initInputField($field, $options = [])
{
if (!isset($options['secure'])) {
- $options['secure'] = (bool)$this->request->param('_Token');
+ $options['secure'] = (bool)$this->request->getParam('_Token');
}
$context = $this->_getContext();
diff --git a/src/View/Helper/IdGeneratorTrait.php b/src/View/Helper/IdGeneratorTrait.php
index 7d7a737ddc4..baabb9d818b 100644
--- a/src/View/Helper/IdGeneratorTrait.php
+++ b/src/View/Helper/IdGeneratorTrait.php
@@ -14,7 +14,7 @@
*/
namespace Cake\View\Helper;
-use Cake\Utility\Inflector;
+use Cake\Utility\Text;
/**
* A trait that provides id generating methods to be
@@ -79,7 +79,7 @@ protected function _id($name, $val)
*/
protected function _domId($value)
{
- $domId = mb_strtolower(Inflector::slug($value, '-'));
+ $domId = mb_strtolower(Text::slug($value, '-'));
if ($this->_idPrefix) {
$domId = $this->_idPrefix . '-' . $domId;
}
diff --git a/src/View/Helper/PaginatorHelper.php b/src/View/Helper/PaginatorHelper.php
index 5db4e3bc993..d782f4d6943 100644
--- a/src/View/Helper/PaginatorHelper.php
+++ b/src/View/Helper/PaginatorHelper.php
@@ -103,7 +103,7 @@ public function __construct(View $View, array $config = [])
unset($query['page'], $query['limit'], $query['sort'], $query['direction']);
$this->config(
'options.url',
- array_merge($this->request->param('pass'), ['?' => $query])
+ array_merge($this->request->getParam('pass'), ['?' => $query])
);
}
@@ -118,11 +118,11 @@ public function params($model = null)
if (empty($model)) {
$model = $this->defaultModel();
}
- if (!$this->request->param('paging') || !$this->request->param('paging.' . $model)) {
+ if (!$this->request->getParam('paging') || !$this->request->getParam('paging.' . $model)) {
return [];
}
- return $this->request->param('paging.' . $model);
+ return $this->request->getParam('paging.' . $model);
}
/**
@@ -152,19 +152,19 @@ public function param($key, $model = null)
public function options(array $options = [])
{
if (!empty($options['paging'])) {
- if (!$this->request->param('paging')) {
+ if (!$this->request->getParam('paging')) {
$this->request->params['paging'] = [];
}
- $this->request->params['paging'] = $options['paging'] + $this->request->param('paging');
+ $this->request->params['paging'] = $options['paging'] + $this->request->getParam('paging');
unset($options['paging']);
}
$model = $this->defaultModel();
if (!empty($options[$model])) {
- if (!$this->request->param('paging.' . $model)) {
+ if (!$this->request->getParam('paging.' . $model)) {
$this->request->params['paging'][$model] = [];
}
- $this->request->params['paging'][$model] = $options[$model] + $this->request->param('paging.' . $model);
+ $this->request->params['paging'][$model] = $options[$model] + $this->request->getParam('paging.' . $model);
unset($options[$model]);
}
$this->_config['options'] = array_filter($options + $this->_config['options']);
@@ -640,10 +640,10 @@ public function defaultModel($model = null)
if ($this->_defaultModel) {
return $this->_defaultModel;
}
- if (!$this->request->param('paging')) {
+ if (!$this->request->getParam('paging')) {
return null;
}
- list($this->_defaultModel) = array_keys($this->request->param('paging'));
+ list($this->_defaultModel) = array_keys($this->request->getParam('paging'));
return $this->_defaultModel;
}
diff --git a/src/View/View.php b/src/View/View.php
index 152042fffda..819ae50fff4 100644
--- a/src/View/View.php
+++ b/src/View/View.php
@@ -113,7 +113,7 @@ class View implements EventDispatcherInterface
* Current passed params. Passed to View from the creating Controller for convenience.
*
* @var array
- * @deprecated 3.1.0 Use `$this->request->param('pass')` instead.
+ * @deprecated 3.1.0 Use `$this->request->getParam('pass')` instead.
*/
public $passedArgs = [];
@@ -1226,8 +1226,8 @@ protected function _getElementFileName($name, $pluginCheck = true)
protected function _getSubPaths($basePath)
{
$paths = [$basePath];
- if ($this->request->param('prefix')) {
- $prefixPath = explode('/', $this->request->param('prefix'));
+ if ($this->request->getParam('prefix')) {
+ $prefixPath = explode('/', $this->request->getParam('prefix'));
$path = '';
foreach ($prefixPath as $prefixPart) {
$path .= Inflector::camelize($prefixPart) . DIRECTORY_SEPARATOR;