瀏覽代碼

[DOC] Add default value to BlogPost sample class (#3703)

Set `BlogPost::$draft` to `false` by default.
florianlenz 9 年之前
父節點
當前提交
34139dd67f
共有 1 個文件被更改,包括 24 次插入0 次删除
  1. 24 0
      Resources/doc/getting_started/creating_an_admin.rst

+ 24 - 0
Resources/doc/getting_started/creating_an_admin.rst

@@ -48,6 +48,30 @@ After this, you'll need to tweak the entities a bit:
 
 
 .. code-block:: php
 .. code-block:: php
 
 
+Set the default value to ``false``.
+
+.. code-block:: php
+
+    // src/AppBundle/Entity/BlogPost.php
+
+    // ...
+    class BlogPost
+    {
+        // ...
+
+        /**
+         * @var bool
+         *
+         * @ORM\Column(name="draft", type="boolean")
+         */
+        private $draft = false;
+
+        // ...
+    }
+
+.. code-block:: php
+
+
     // src/AppBundle/Entity/Category.php
     // src/AppBundle/Entity/Category.php
 
 
     // ...
     // ...