質問編集履歴
2
画像の追加
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -120,4 +120,8 @@
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
}
|
|
123
|
-
```
|
|
123
|
+
```
|
|
124
|
+
dd($this->request->getData());のアップロードした場合
|
|
125
|
+

|
|
126
|
+
dd($this->request->getData());のアップロードしない場合
|
|
127
|
+

|
1
PatchEntityの追加
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -60,4 +60,64 @@
|
|
|
60
60
|
return $validator;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
```
|
|
64
|
+
```
|
|
65
|
+
<?php
|
|
66
|
+
declare(strict_types=1);
|
|
67
|
+
|
|
68
|
+
namespace App\Model\Entity;
|
|
69
|
+
|
|
70
|
+
use Cake\ORM\Entity;
|
|
71
|
+
use Cake\Auth\DefaultPasswordHasher;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Employee Entity
|
|
75
|
+
*
|
|
76
|
+
* @property int $id
|
|
77
|
+
* @property string $name
|
|
78
|
+
* @property string $password
|
|
79
|
+
* @property string|null $image
|
|
80
|
+
* @property string $email
|
|
81
|
+
* @property int $role
|
|
82
|
+
* @property \Cake\I18n\FrozenTime $created
|
|
83
|
+
* @property \Cake\I18n\FrozenTime $modified
|
|
84
|
+
*/
|
|
85
|
+
class Employee extends Entity
|
|
86
|
+
{
|
|
87
|
+
/**
|
|
88
|
+
* Fields that can be mass assigned using newEntity() or patchEntity().
|
|
89
|
+
*
|
|
90
|
+
* Note that when '*' is set to true, this allows all unspecified fields to
|
|
91
|
+
* be mass assigned. For security purposes, it is advised to set '*' to false
|
|
92
|
+
* (or remove it), and explicitly make individual fields accessible as needed.
|
|
93
|
+
*
|
|
94
|
+
* @var array
|
|
95
|
+
*/
|
|
96
|
+
protected $_accessible = [
|
|
97
|
+
'name' => true,
|
|
98
|
+
'password' => true,
|
|
99
|
+
'image' => true,
|
|
100
|
+
'email' => true,
|
|
101
|
+
'role' => true,
|
|
102
|
+
'created' => true,
|
|
103
|
+
'modified' => true,
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Fields that are excluded from JSON versions of the entity.
|
|
108
|
+
*
|
|
109
|
+
* @var array
|
|
110
|
+
*/
|
|
111
|
+
protected $_hidden = [
|
|
112
|
+
'password',
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
protected function _setPassword($password)
|
|
116
|
+
{
|
|
117
|
+
if (strlen($password) > 0) {
|
|
118
|
+
return (new DefaultPasswordHasher)->hash($password);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
}
|
|
63
123
|
```
|