Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit a921f81

Browse files
author
David Yell
committed
Fixed the deprecations and bumped the minimum cakephp version
1 parent da28edb commit a921f81

File tree

7 files changed

+17
-189
lines changed

7 files changed

+17
-189
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.6",
17-
"cakephp/cakephp": "^3.4",
16+
"php": ">=7.0",
17+
"cakephp/cakephp": "^3.7",
1818
"friendsofcake/bootstrap-ui": "~1.0"
1919
},
2020
"suggest": {

src/Template/Bake/Element/Controller/add.ctp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $compact = ["'" . $singularName . "'"];
1111
{
1212
$<%= $singularName %> = $this-><%= $currentModelName %>->newEntity();
1313
if ($this->request->is('post')) {
14-
$<%= $singularName %> = $this-><%= $currentModelName %>->patchEntity($<%= $singularName %>, $this->request->data);
14+
$<%= $singularName %> = $this-><%= $currentModelName %>->patchEntity($<%= $singularName %>, $this->getRequest()->getData());
1515
if ($this-><%= $currentModelName; %>->save($<%= $singularName %>)) {
1616
$this->Flash->success(__('The <%= strtolower($singularHumanName) %> has been saved.'));
1717

src/Template/Bake/Element/Controller/edit.ctp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $compact = ["'" . $singularName . "'"];
2828
]);
2929

3030
if ($this->request->is(['patch', 'post', 'put'])) {
31-
$<%= $singularName %> = $this-><%= $currentModelName %>->patchEntity($<%= $singularName %>, $this->request->getData());
31+
$<%= $singularName %> = $this-><%= $currentModelName %>->patchEntity($<%= $singularName %>, $this->getRequest()->getData());
3232
if ($this-><%= $currentModelName; %>->save($<%= $singularName %>)) {
3333
$this->Flash->success(__('The <%= strtolower($singularHumanName) %> has been saved.'));
3434

src/Template/Bake/Element/form.ctp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use Cake\Utility\Inflector;
33

44
$fields = collection($fields)
55
->filter(function($field) use ($schema) {
6-
return $schema->columnType($field) !== 'binary';
6+
return $schema->getColumnType($field) !== 'binary';
77
});
88
%>
99
<div class="<%= $pluralVar %> form">
@@ -17,7 +17,7 @@ $fields = collection($fields)
1717
continue;
1818
}
1919
if (isset($keyFields[$field])) {
20-
$fieldData = $schema->column($field);
20+
$fieldData = $schema->getColumn($field);
2121
if (!empty($fieldData['null'])) {
2222
%>
2323
echo $this->Form->control('<%= $field %>', ['options' => $<%= $keyFields[$field] %>, 'empty' => true]);
@@ -30,7 +30,7 @@ $fields = collection($fields)
3030
continue;
3131
}
3232
if (!in_array($field, ['created', 'modified', 'updated'])) {
33-
$fieldData = $schema->column($field);
33+
$fieldData = $schema->getColumn($field);
3434
if (($fieldData['type'] === 'date') && (!empty($fieldData['null']))) {
3535
%>
3636
echo $this->Form->control('<%= $field %>', ['empty' => true, 'default' => '']);

src/Template/Bake/Model/table.ctp

Lines changed: 0 additions & 172 deletions
This file was deleted.

src/Template/Bake/Template/index.ctp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use Cake\Utility\Inflector;
33

44
$fields = collection($fields)
55
->filter(function($field) use ($schema) {
6-
return !in_array($schema->columnType($field), ['binary', 'text']);
6+
return !in_array($schema->getColumnType($field), ['binary', 'text']);
77
})
88
->take(7);
99
%>
10-
<h1><?= $this->request->controller?></h1>
10+
<h1><?= $this->getRequest()->getParam('controller')?></h1>
1111

1212
<div class="buttons">
1313
<?= $this->Html->link('<span class=\'glyphicon glyphicon-plus\'></span> Add new', ['action' => 'add'], ['class' => 'btn btn-primary', 'escape' => false]);?>
@@ -29,11 +29,11 @@ $fields = collection($fields)
2929
<tr>
3030
<% foreach ($fields as $field):
3131
$class = '';
32-
if (in_array($schema->columnType($field), ['integer', 'biginteger', 'decimal', 'float'])) {
32+
if (in_array($schema->getColumnType($field), ['integer', 'biginteger', 'decimal', 'float'])) {
3333
$class = ' class="number"';
34-
} elseif (in_array($schema->columnType($field), ['date', 'datetime', 'timestamp', 'time'])) {
34+
} elseif (in_array($schema->getColumnType($field), ['date', 'datetime', 'timestamp', 'time'])) {
3535
$class = ' class="time"';
36-
} elseif (in_array($schema->columnType($field), ['boolean'])) {
36+
} elseif (in_array($schema->getColumnType($field), ['boolean'])) {
3737
$class = ' class="boolean"';
3838
}
3939
%>
@@ -61,15 +61,15 @@ $fields = collection($fields)
6161
}
6262
}
6363
if ($isKey !== true) {
64-
if (in_array($schema->columnType($field), ['integer', 'biginteger', 'decimal', 'float'])) {
64+
if (in_array($schema->getColumnType($field), ['integer', 'biginteger', 'decimal', 'float'])) {
6565
%>
6666
<td class="number"><?= $this->Number->format($<%= $singularVar %>->get('<%= $field %>')) ?></td>
6767
<%
68-
} elseif (in_array($schema->columnType($field), ['date', 'datetime', 'timestamp', 'time'])) {
68+
} elseif (in_array($schema->getColumnType($field), ['date', 'datetime', 'timestamp', 'time'])) {
6969
%>
7070
<td class="time"><?= $this->Time->timeAgoInWords($<%= $singularVar %>->get('<%= $field %>')) ?></td>
7171
<%
72-
} elseif (in_array($schema->columnType($field), ['boolean'])) {
72+
} elseif (in_array($schema->getColumnType($field), ['boolean'])) {
7373
%>
7474
<td class="boolean"><?php
7575
if ($<%= $singularVar %>->get('<%= $field %>')) {

src/Template/Bake/Template/view.ctp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ $associationFields = collection($fields)
1818

1919
$groupedFields = collection($fields)
2020
->filter(function($field) use ($schema) {
21-
return $schema->columnType($field) !== 'binary';
21+
return $schema->getColumnType($field) !== 'binary';
2222
})
2323
->groupBy(function($field) use ($schema, $associationFields) {
24-
$type = $schema->columnType($field);
24+
$type = $schema->getColumnType($field);
2525
if (isset($associationFields[$field])) {
2626
return 'string';
2727
}

0 commit comments

Comments
 (0)