Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ja/controllers/components/pagination.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,16 @@ PaginatorComponent を直接使用するのがよいです。こちらは、
複数クエリのページネーション
============================

コントローラの ``$paginate`` プロパティの中や ``paginate()`` メソッドを呼ぶ際に
``scope`` オプションを使うことで、単一のコントローラアクションに複数モデルで
paginate できます。 ::

// paginate プロパティ
public $paginate = [
'Articles' => ['scope' => 'article'],
'Tags' => ['scope' => 'tag']
];

// コントローラのアクションの中で
$articles = $this->paginate($this->Articles, ['scope' => 'article']);
$tags = $this->paginate($this->Tags, ['scope' => 'tag']);
Expand Down
6 changes: 3 additions & 3 deletions ja/core-libraries/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ Formクラスを作ったら、たぶんHTMLフォームを作成したいでし
FormHelperはFormオブジェクトをORMエンティティとちょうど同じように理解します::

echo $this->Form->create($contact);
echo $this->Form->input('name');
echo $this->Form->input('email');
echo $this->Form->input('body');
echo $this->Form->control('name');
echo $this->Form->control('email');
echo $this->Form->control('body');
echo $this->Form->button('Submit');
echo $this->Form->end();

Expand Down
9 changes: 6 additions & 3 deletions ja/core-libraries/hash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Hash パス構文
| ``{s}`` | 文字列キーを意味する。数値文字列を含め、 |
| | どんな文字列でも一致する。 |
+--------------------------------+--------------------------------------------+
| ``{*}`` | 任意の値と一致する。 |
+--------------------------------+--------------------------------------------+
| ``Foo`` | 完全に同じ値だった場合のみ一致する。 |
+--------------------------------+--------------------------------------------+

Expand Down Expand Up @@ -71,7 +73,7 @@ Hash パス構文
.. php:staticmethod:: get(array|\ArrayAccess $data, $path, $default = null)

``get()`` は ``extract()`` のシンプル版で、直接的に指定するパス式のみがサポートされます。
``{n}`` ``{s}`` 、マッチャーを使ったパスはサポートされません。
``{n}`` ``{s}`` 、 ``{*}`` 、または、マッチャーを使ったパスはサポートされません。
配列から1つの値だけを取り出したい場合に ``get()`` を使ってください。
もしマッチするパスが見つからない場合、デフォルト値が返ります。

Expand Down Expand Up @@ -112,7 +114,8 @@ Hash パス構文
]
]

``{n}`` や ``{s}`` を使ったパスを使うことで、複数のポイントにデータを挿入することができます。 ::
``{n}`` 、 ``{s}`` そして ``{*}`` を使ったパスを使うことで、
複数のポイントにデータを挿入することができます。 ::

$users = Hash::insert($users, '{n}.new', 'value');

Expand Down Expand Up @@ -154,7 +157,7 @@ Hash パス構文
]
*/

``{n}`` ``{s}`` を使うことで、複数の値を一度に削除することができます。
``{n}`` ``{s}`` そして ``{*}`` を使うことで、複数の値を一度に削除することができます。
また、``remove()`` では属性のマッチャーを使用することもできます。 ::

$data = [
Expand Down
4 changes: 2 additions & 2 deletions ja/elasticsearch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ ElasticSearch プラグインは elasticsearch インデックスと作用する

// src/Template/Articles/add.ctp の中で
<?= $this->Form->create($article) ?>
<?= $this->Form->input('title') ?>
<?= $this->Form->input('body') ?>
<?= $this->Form->control('title') ?>
<?= $this->Form->control('body') ?>
<?= $this->Form->button('Save') ?>
<?= $this->Form->end() ?>

Expand Down
10 changes: 5 additions & 5 deletions ja/orm/behaviors/translate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,19 +410,19 @@ TranslateBehavior の背後にある哲学は、デフォルトの言語を表
$this->Articles->save($article);

3.3.0 では、複数の翻訳での動作は簡素化されました。
翻訳されたフィールドの入力フォームを作成することができます。 ::
翻訳されたフィールドのフォームコントロールを作成することができます。 ::

// ビューテンプレートの中で
<?= $this->Form->create($article); ?>
<fieldset>
<legend>French</legend>
<?= $this->Form->input('_translations.fr.title'); ?>
<?= $this->Form->input('_translations.fr.body'); ?>
<?= $this->Form->control('_translations.fr.title'); ?>
<?= $this->Form->control('_translations.fr.body'); ?>
</fieldset>
<fieldset>
<legend>Spanish</legend>
<?= $this->Form->input('_translations.es.title'); ?>
<?= $this->Form->input('_translations.es.body'); ?>
<?= $this->Form->control('_translations.es.title'); ?>
<?= $this->Form->control('_translations.es.body'); ?>
</fieldset>

コントローラの中では、通常通りにデータをマーシャリングできますが、
Expand Down
2 changes: 1 addition & 1 deletion ja/orm/behaviors/tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CakePHP は内部構造を構築することができます。 ::
$list = $categories->find('treeList');

// CakePHP テンプレートファイルの中で
echo $this->Form->input('categories', ['options' => $list]);
echo $this->Form->control('categories', ['options' => $list]);

// もしくは、CLI スクリプトなどでプレーンテキストで出力できます
foreach ($list as $categoryName) {
Expand Down