Skip to content

Commit efbc2d8

Browse files
committed
updating for latest cakephp version
1 parent 385513a commit efbc2d8

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

src/Controller/DemoController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function image()
3333
if($this->request->is('post')) {
3434
$this->Demo->setCaptcha('Captcha', $this->Captcha->getCode('Captcha'));
3535
$demo = $this->Demo->newEntity($this->request->getData());
36-
if ($demo->errors()) {
36+
if ($demo->getErrors()) {
3737
$this->Flash->error(__('Validation failed.'));
3838
} else {
3939
$this->Flash->success(__('Validation success.'));
@@ -47,7 +47,7 @@ public function recaptcha()
4747
if($this->request->is('post')) {
4848
//$this->Demo->setCaptcha('Captcha', $this->Captcha->getCode('Captcha'));
4949
$demo = $this->Demo->newEntity($this->request->getData());
50-
if ($demo->errors()) {
50+
if ($demo->getErrors()) {
5151
$this->Flash->error(__('Validation failed.'));
5252
} else {
5353
$this->Flash->success(__('Validation success.'));
@@ -61,7 +61,7 @@ public function math()
6161
if($this->request->is('post')) {
6262
$this->Demo->setCaptcha('Captcha', $this->Captcha->getCode('Captcha'));
6363
$demo = $this->Demo->newEntity($this->request->getData());
64-
if ($demo->errors()) {
64+
if ($demo->getErrors()) {
6565
$this->Flash->error(__('Validation failed.'));
6666
} else {
6767
$this->Flash->success(__('Validation success.'));

src/Model/Table/DemoTable.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ public function validationDefault(Validator $validator)
5555
->requirePresence('name', 'create')
5656
->notEmptyString('name');
5757

58-
$validator
59-
->email('email')
60-
->requirePresence('email', 'create')
61-
->notEmptyString('email');
62-
6358
return $validator;
6459
}
6560

src/Template/Demo/image.ctp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $this->Html->css('/captcha_demo/css/styles', ['block' => true]);
1515
<?= $this->Form->create($demo, ['novalidate']) ?>
1616
<fieldset style="padding-left:0;">
1717
<?php
18-
echo $this->Form->input('name', ['placeholder'=>'Enter name']);
18+
echo $this->Form->control('name', ['placeholder'=>'Enter name']);
1919
echo $this->Captcha->create('Captcha',['reload_txt'=>false]);
2020
?>
2121
<?= $this->Form->button(__('Submit')) ?>

src/Template/Demo/math.ctp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $this->Html->css('/captcha_demo/css/styles', ['block' => true]);
1515
<?= $this->Form->create($demo, ['novalidate']) ?>
1616
<fieldset style="padding-left:0;">
1717
<?php
18-
echo $this->Form->input('name', ['placeholder'=>'enter anything']);
18+
echo $this->Form->control('name', ['placeholder'=>'enter anything']);
1919
echo $this->Captcha->create('Captcha', [
2020
'type'=>'math'
2121
]);

src/Template/Demo/recaptcha.ctp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $this->Html->css('/captcha_demo/css/styles', ['block' => true]);
1616
<?= $this->Form->create($demo, ['novalidate']) ?>
1717
<fieldset style="padding-left:0;">
1818
<?php
19-
echo $this->Form->input('name', ['placeholder'=>'Enter name']);
19+
echo $this->Form->control('name', ['placeholder'=>'Enter name']);
2020
echo $this->Captcha->create('Captcha', [
2121
'type'=>'recaptcha',
2222
'sitekey'=>'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

0 commit comments

Comments
 (0)