File tree Expand file tree Collapse file tree 9 files changed +39
-14
lines changed Expand file tree Collapse file tree 9 files changed +39
-14
lines changed Original file line number Diff line number Diff line change 2020:doc: `ブログチュートリアル </tutorials-and-examples/blog-auth-example/auth >`
2121の中で順を追って説明しています。
2222
23+ もし、CakePHP のための既存の認証や認可の解決方法を探しているなら、Awesome CakePHP リストの
24+ `Authentication and Authorization <https://github.com/FriendsOfCake/awesome-cakephp/blob/master/README.md#authentication-and-authorization >`_ セクションを見てください。
2325
2426認証
2527====
Original file line number Diff line number Diff line change 4141 $email->to('test@example.com', 'ToTest Example');
4242 // メールの To 受信者は test@example.com
4343
44+ .. deprecated :: 3.4.0
45+ 代わりに ``setFrom() `` 、 ``setTo() `` 、 ``setCc() `` 、 ``setBcc() ``
46+ そして、 ``setSubject() `` を使用してください。
47+
4448送り主の選択
4549------------
4650
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ CakePHP におけるほとんどのことがそうであるように、テスト
129129
130130.. versionadded :: 3.4.1
131131 PHPUnit 6 のサポートが追加されました。5.7.0 より低いバージョンの PHPUnit を
132- 使用する場合、テストケースは Cake のクラスまたは ``PHPUnit_Framework_TestCase `` を
132+ 使用する場合、テストケースは CakePHP のクラスまたは ``PHPUnit_Framework_TestCase `` を
133133 継承してください。
134134
135135最初のテストケース作成
Original file line number Diff line number Diff line change @@ -617,7 +617,7 @@ CoursesMemberships モデルを作ればよいのです。以下のモデルを
617617 public function initialize(array $config)
618618 {
619619 $this->belongsToMany('Courses', [
620- 'through' => 'CourseMemberships ',
620+ 'through' => 'CoursesMemberships ',
621621 ]);
622622 }
623623 }
@@ -627,7 +627,7 @@ CoursesMemberships モデルを作ればよいのです。以下のモデルを
627627 public function initialize(array $config)
628628 {
629629 $this->belongsToMany('Students', [
630- 'through' => 'CourseMemberships ',
630+ 'through' => 'CoursesMemberships ',
631631 ]);
632632 }
633633 }
Original file line number Diff line number Diff line change @@ -521,12 +521,14 @@ Type クラスが必要になります。 ::
521521 if ($value instanceof Point) {
522522 return new FunctionExpression(
523523 'POINT',
524- $value->lat(),
525- $value->long()
524+ [
525+ $value->lat(),
526+ $value->long()
527+ ]
526528 );
527529 }
528530 if (is_array($value)) {
529- return new FunctionExpression('POINT', $value[0], $value[1]);
531+ return new FunctionExpression('POINT', [ $value[0], $value[1] ]);
530532 }
531533 // その他のケースを処理
532534 }
Original file line number Diff line number Diff line change @@ -79,11 +79,14 @@ atomic オプションで無効化することも出来ます。 ::
7979
8080.. php :method :: deleteOrFail($entity, $options = [])
8181
82-
83- このメソッドを使用すると、エンティティーが新しく主キーの値を持たず、
84- アプリケーションルールのチェックに失敗したり、削除がコールバックによって中断された場合、
82+ このメソッドを使用すると、次の条件で
8583:php:exc: `Cake\\ ORM\\ Exception\\ PersistenceFailedException ` を投げます。
8684
85+ * エンティティーが新しい場合
86+ * エンティティーが主キーの値を持たない場合
87+ * アプリケーションルールのチェックが失敗した場合
88+ * 削除コールバックによって中断された場合
89+
8790保存に失敗したエンティティーを追跡する場合、
8891:php:meth: `Cake\\ ORM\E xception\\ PersistenceFailedException::getEntity() ` メソッドを
8992使用できます。 ::
Original file line number Diff line number Diff line change @@ -245,18 +245,25 @@ CakePHP の ORM を使うためにエンティティークラスを生成する
245245.. php :method :: errors($field = null, $errors = null)
246246
247247:ref: `エンティティーの保存 <saving-entities >` がされた後、どんなバリデーションエラーも
248- エンティティー自身に保存されます。バリデーションエラーには ``errors () `` メソッドを使って
249- アクセスできます 。 ::
248+ エンティティー自身に保存されます。バリデーションエラーには ``getErrors () `` や
249+ `` getError() `` メソッドを使ってアクセスできます 。 ::
250250
251251 // エラーの取得
252+ $errors = $user->getErrors();
253+ // 3.4.0 より前
252254 $errors = $user->errors();
253255
254256 // 1つのフィールドのエラーを取得
257+ $errors = $user->getError('password');
258+ // 3.4.0 より前
255259 $errors = $user->errors('password');
256260
257- ``errors () `` はまたエンティティーにエラーをセットするために使うこともできます。
261+ ``setErrors() `` や `` setError () `` はまたエンティティーにエラーをセットするために使うこともできます。
258262これにより、エラーメッセージで動くコードのテストが簡単になります。 ::
259263
264+ $user->setError('password', ['Password is required']);
265+ $user->setErrors(['pasword' => ['Password is required'], 'username' => ['Username is required']]);
266+ // 3.4.0 より前
260267 $user->errors('password', ['Password is required.']);
261268
262269.. _entities-mass-assignment :
Original file line number Diff line number Diff line change @@ -1101,9 +1101,13 @@ belongsToMany アソシエーションのそれぞれのエンティティーは
11011101.. php :method :: saveOrFail($entity, $options = [])
11021102
11031103
1104- このメソッドを使用すると、アプリケーションルールのチェックに失敗したり、
1105- エンティティーにエラーが含まれていたり、保存がコールバックによって中断された場合、
1104+ このメソッドを使用すると、次の条件で
11061105:php:exc: `Cake\\ ORM\\ Exception\\ PersistenceFailedException ` を投げます。
1106+
1107+ * アプリケーションルールのチェックに失敗した場合
1108+ * エンティティーにエラーが含まれている場合
1109+ * 保存がコールバックによって中断された場合
1110+
11071111これを使用することで、例えば、Shell のタスクの中で複雑なデータベースの操作を
11081112実行する際に役に立ちます。
11091113
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ CakePHP ではデータの検証には二つの段階があります:
2727 // エンティティー検証失敗。
2828 }
2929
30+ .. versionadded :: 3.4.0
31+ ``getErrors() `` 関数は追加されました。
32+
3033バリデーションが有効になっている状態でエンティティーを構築すると、次のことが起こります:
3134
32351. バリデータオブジェクトが作成されます。
You can’t perform that action at this time.
0 commit comments