File tree Expand file tree Collapse file tree 5 files changed +17
-9
lines changed
ja/tutorials-and-examples/cms Expand file tree Collapse file tree 5 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ fields to be translated. For that we create a shadow table ``articles_translatio
3535 CREATE TABLE `articles_translations` (
3636 `id` int(11) NOT NULL,
3737 `locale` varchar(5) NOT NULL,
38- `title` varchar(255) NOT NULL ,
39- `body` text NOT NULL ,
38+ `title` varchar(255),
39+ `body` text,
4040 PRIMARY KEY (`id`,`locale`)
4141 );
4242
Original file line number Diff line number Diff line change @@ -488,6 +488,9 @@ CakePHP recommends a few conventions for enums:
488488- Enum classnames should follow ``{Entity}{ColumnName} `` style to enable
489489 detection while running bake and to aid with project consistency.
490490- Enum cases should use CamelCase style.
491+ - Enums should implement the ``Cake\Database\Type\EnumLabelInterface `` to
492+ improve compatibility with bake, and ``FormHelper ``.
493+
491494
492495.. _adding-custom-database-types :
493496
Original file line number Diff line number Diff line change @@ -32,8 +32,7 @@ CMS チュートリアル - Articles コントローラーの作成
3232 {
3333 public function index()
3434 {
35- $this->loadComponent('Paginator');
36- $articles = $this->Paginator->paginate($this->Articles->find());
35+ $articles = $this->paginate($this->Articles);
3736 $this->set(compact('articles'));
3837 }
3938 }
Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ CakePHP のモデルは ``Table`` と ``Entity`` オブジェクトで構成さ
113113
114114 <?php
115115 // src/Model/Table/ArticlesTable.php
116+ declare(strict_types=1);
117+
116118 namespace App\Model\Table;
117119
118120 use Cake\ORM\Table;
@@ -121,6 +123,7 @@ CakePHP のモデルは ``Table`` と ``Entity`` オブジェクトで構成さ
121123 {
122124 public function initialize(array $config) : void
123125 {
126+ parent::initialize($config)
124127 $this->addBehavior('Timestamp');
125128 }
126129 }
@@ -152,9 +155,12 @@ Table オブジェクトを ``ArticlesTable`` と名付けることで、CakePHP
152155 class Article extends Entity
153156 {
154157 protected array $_accessible = [
155- '*' => true,
156- 'id' => false,
157- 'slug' => false,
158+ 'title' => true,
159+ 'body' => true,
160+ 'published' => true,
161+ 'created' => true,
162+ 'modified' => true,
163+ 'users' => true,
158164 ];
159165 }
160166
Original file line number Diff line number Diff line change @@ -42,15 +42,15 @@ cURL がインストールされていたら、次のように実行するのが
4242
4343.. code-block :: console
4444
45- php composer.phar create-project --prefer-dist cakephp/app:4 .* cms
45+ php composer.phar create-project --prefer-dist cakephp/app:5 .* cms
4646
4747 `Composer Windows Installer <https://getcomposer.org/Composer-Setup.exe >`_
4848をダウンロードして実行した場合、インストールディレクトリー (例えば、 C:\\ wamp\\ www\\ dev\\ cakephp3)
4949からターミナルに次の行を入力してください。
5050
5151.. code-block :: console
5252
53- composer self-update && composer create-project --prefer-dist cakephp/app:4 .* cms
53+ composer self-update && composer create-project --prefer-dist cakephp/app:5 .* cms
5454
5555 Composer を使うメリットは、 正しいファイルパーミッションの設定や、 **config/app.php **
5656ファイルの作成などのように、自動的に完全なセットアップをしてくれることです。
You can’t perform that action at this time.
0 commit comments