diff --git a/composer.json b/composer.json index 0f0b331a..4159d3f8 100644 --- a/composer.json +++ b/composer.json @@ -29,14 +29,14 @@ } ], "require": { - "cakephp/cakephp": "~3.4", - "friendsofcake/crud": "*", - "friendsofcake/bootstrap-ui": "~1.2" + "cakephp/cakephp": "^3.5", + "friendsofcake/crud": "^5.4", + "friendsofcake/bootstrap-ui": "^1.4" }, "require-dev": { "friendsofcake/cakephp-test-utilities": "^1.0", "markstory/asset_compress": "^3.2", - "phpunit/phpunit": "^5.7|^6.0" + "phpunit/phpunit": "^5.7.14|^6.0" }, "autoload": { "psr-4": { diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index abc08d42..06a3c489 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -65,7 +65,7 @@ public function beforePaginate(Event $event) $this->associations = $this->_associations(array_keys($related)); } - if (!$event->getSubject()->query->contain()) { + if (!$event->getSubject()->query->getContain()) { $event->getSubject()->query->contain($this->_getRelatedModels(['manyToOne', 'oneToOne'])); } } @@ -78,7 +78,7 @@ public function beforePaginate(Event $event) */ public function beforeRender(Event $event) { - if ($this->_controller()->name === 'Error') { + if ($this->_controller()->getName() === 'Error') { return; } @@ -147,7 +147,7 @@ protected function _getPageTitle() $scope = $action->getConfig('scope'); $request = $this->_request(); - $actionName = Inflector::humanize(Inflector::underscore($request->action)); + $actionName = Inflector::humanize(Inflector::underscore($request->getParam('action'))); $controllerName = $this->_controllerName(); if ($scope === 'table') { @@ -211,14 +211,14 @@ protected function _getRelatedModels($associationTypes = []) foreach ($associationTypes as $assocType) { $associations = array_merge( $associations, - $this->_table()->associations()->type($assocType) + $this->_table()->associations()->getByType($assocType) ); } } $models = []; foreach ($associations as $assoc) { - $models[] = $assoc->name(); + $models[] = $assoc->getName(); } } @@ -265,9 +265,9 @@ protected function _getPageVariables() 'modelSchema' => $table->getSchema(), 'displayField' => $table->getDisplayField(), 'singularHumanName' => Inflector::humanize(Inflector::underscore(Inflector::singularize($controller->modelClass))), - 'pluralHumanName' => Inflector::humanize(Inflector::underscore($controller->name)), - 'singularVar' => Inflector::singularize($controller->name), - 'pluralVar' => Inflector::variable($controller->name), + 'pluralHumanName' => Inflector::humanize(Inflector::underscore($controller->getName())), + 'singularVar' => Inflector::singularize($controller->getName()), + 'pluralVar' => Inflector::variable($controller->getName()), 'primaryKey' => $table->getPrimaryKey(), ]; @@ -351,7 +351,7 @@ protected function _controllerName() $inflections[] = 'singularize'; } - $baseName = $this->_controller()->name; + $baseName = $this->_controller()->getName(); foreach ($inflections as $inflection) { $baseName = Inflector::$inflection($baseName); } @@ -539,13 +539,13 @@ protected function _associations(array $whitelist = []) $associationConfiguration[$type] = []; } - $assocKey = $association->name(); + $assocKey = $association->getName(); $associationConfiguration[$type][$assocKey]['model'] = $assocKey; $associationConfiguration[$type][$assocKey]['type'] = $type; - $associationConfiguration[$type][$assocKey]['primaryKey'] = $association->target()->getPrimaryKey(); - $associationConfiguration[$type][$assocKey]['displayField'] = $association->target()->getDisplayField(); - $associationConfiguration[$type][$assocKey]['foreignKey'] = $association->foreignKey(); - $associationConfiguration[$type][$assocKey]['propertyName'] = $association->property(); + $associationConfiguration[$type][$assocKey]['primaryKey'] = $association->getTarget()->getPrimaryKey(); + $associationConfiguration[$type][$assocKey]['displayField'] = $association->getTarget()->getDisplayField(); + $associationConfiguration[$type][$assocKey]['foreignKey'] = $association->getForeignKey(); + $associationConfiguration[$type][$assocKey]['propertyName'] = $association->getProperty(); $associationConfiguration[$type][$assocKey]['plugin'] = pluginSplit($association->className())[0]; $associationConfiguration[$type][$assocKey]['controller'] = $assocKey; $associationConfiguration[$type][$assocKey]['entity'] = Inflector::singularize(Inflector::underscore($assocKey)); diff --git a/src/Listener/ViewSearchListener.php b/src/Listener/ViewSearchListener.php index b876ef2a..0b01ffd4 100644 --- a/src/Listener/ViewSearchListener.php +++ b/src/Listener/ViewSearchListener.php @@ -121,7 +121,7 @@ protected function _deriveFields() $input['value'] = $request->getQuery($field); - if (empty($input['options']) && $schema->columnType($field) === 'boolean') { + if (empty($input['options']) && $schema->getColumnType($field) === 'boolean') { $input['options'] = ['No', 'Yes']; $input['type'] = 'select'; } diff --git a/src/Template/Element/actions.ctp b/src/Template/Element/actions.ctp index 815d6205..92f6d951 100644 --- a/src/Template/Element/actions.ctp +++ b/src/Template/Element/actions.ctp @@ -3,8 +3,8 @@ $links = []; foreach ($actions as $name => $config) { $config += ['method' => 'GET']; - if ((empty($config['url']['controller']) || $this->request->controller === $config['url']['controller']) && - (!empty($config['url']['action']) && $this->request->action === $config['url']['action']) + if ((empty($config['url']['controller']) || $this->request->getParam('controller') === $config['url']['controller']) && + (!empty($config['url']['action']) && $this->request->getParam('action') === $config['url']['action']) ) { continue; } diff --git a/src/Template/Element/index/bulk_actions/form_end.ctp b/src/Template/Element/index/bulk_actions/form_end.ctp index 4cdd2035..2c47546c 100644 --- a/src/Template/Element/index/bulk_actions/form_end.ctp +++ b/src/Template/Element/index/bulk_actions/form_end.ctp @@ -8,7 +8,7 @@ $submitButton = $this->Form->button(__d('crud', 'Apply'), [ 'name' => '_bulk', ]); -echo $this->Form->input('action', [ +echo $this->Form->control('action', [ 'empty' => __d('crud', 'Bulk Actions'), 'label' => [ 'class' => 'col-sm-2 control-label', diff --git a/src/Template/Element/search.ctp b/src/Template/Element/search.ctp index b2677e4d..42fa2f2c 100644 --- a/src/Template/Element/search.ctp +++ b/src/Template/Element/search.ctp @@ -14,7 +14,7 @@ if (empty($searchInputs)) { ?>
- Form->inputs($searchInputs, ['fieldset' => false]); ?> + Form->controls($searchInputs, ['fieldset' => false]); ?> Form->button(__d('crud', 'Filter results'), ['type' => 'submit', 'class' => 'btn btn-primary']); ?>
diff --git a/src/Template/Layout/default.ctp b/src/Template/Layout/default.ctp index 4c4cccbd..bdccb581 100644 --- a/src/Template/Layout/default.ctp +++ b/src/Template/Layout/default.ctp @@ -1,5 +1,5 @@ - + Html->charset(); ?> <?= $this->get('title');?> diff --git a/src/View/Cell/TablesListCell.php b/src/View/Cell/TablesListCell.php index 0dbc1085..1d9a485f 100644 --- a/src/View/Cell/TablesListCell.php +++ b/src/View/Cell/TablesListCell.php @@ -19,7 +19,7 @@ public function display($tables = null, $blacklist = null) { if (empty($tables)) { $connection = ConnectionManager::get('default'); - $schema = $connection->schemaCollection(); + $schema = $connection->getSchemaCollection(); $tables = $schema->listTables(); ksort($tables); diff --git a/src/View/Helper/CrudViewHelper.php b/src/View/Helper/CrudViewHelper.php index 3868bbe0..3d0e577e 100644 --- a/src/View/Helper/CrudViewHelper.php +++ b/src/View/Helper/CrudViewHelper.php @@ -171,11 +171,8 @@ public function introspect($field, $value, array $options = []) public function columnType($field) { $schema = $this->schema(); - if (method_exists($schema, 'baseColumnType')) { - return $schema->baseColumnType($field); - } - return $schema->columnType($field); + return $schema->getColumnType($field); } /** @@ -390,7 +387,7 @@ public function currentModel() /** * Get model schema. * - * @return \Cake\Database\Schema\Table + * @return \Cake\Database\Schema\TableSchemaInterface */ public function schema() { diff --git a/src/View/Widget/DateTimeWidget.php b/src/View/Widget/DateTimeWidget.php index c8b2ec5e..7602e038 100644 --- a/src/View/Widget/DateTimeWidget.php +++ b/src/View/Widget/DateTimeWidget.php @@ -29,7 +29,7 @@ public function render(array $data, ContextInterface $context) $disabled = isset($data['disabled']) && $data['disabled'] ? 'disabled' : ''; $role = isset($data['role']) ? $data['role'] : 'datetime-picker'; $format = null; - $locale = isset($data['locale']) ? $data['locale'] : I18n::locale(); + $locale = isset($data['locale']) ? $data['locale'] : I18n::getLocale(); $timezoneAware = Configure::read('CrudView.timezoneAwareDateTimeWidget');