Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 33fb21a

Browse filesBrowse files
hrbonzweaverryan
authored andcommitted
add yaml mappings for special field options (chapter 'Field Options')
1 parent 75600c5 commit 33fb21a
Copy full SHA for 33fb21a

File tree

Expand file treeCollapse file tree

1 file changed

+34
-15
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+34
-15
lines changed

‎book/doctrine.rst

Copy file name to clipboardExpand all lines: book/doctrine.rst
+34-15Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,23 +1245,42 @@ Each field can have a set of options applied to it. The available options
12451245
include ``type`` (defaults to ``string``), ``name``, ``length``, ``unique``
12461246
and ``nullable``. Take a few annotations examples:
12471247

1248-
.. code-block:: php-annotations
1248+
.. configuration-block::
12491249

1250-
/**
1251-
* A string field with length 255 that cannot be null
1252-
* (reflecting the default values for the "type", "length" and *nullable* options)
1253-
*
1254-
* @ORM\Column()
1255-
*/
1256-
protected $name;
1250+
.. code-block:: php-annotations
12571251
1258-
/**
1259-
* A string field of length 150 that persists to an "email_address" column
1260-
* and has a unique index.
1261-
*
1262-
* @ORM\Column(name="email_address", unique="true", length="150")
1263-
*/
1264-
protected $email;
1252+
/**
1253+
* A string field with length 255 that cannot be null
1254+
* (reflecting the default values for the "type", "length" and *nullable* options)
1255+
*
1256+
* @ORM\Column()
1257+
*/
1258+
protected $name;
1259+
1260+
/**
1261+
* A string field of length 150 that persists to an "email_address" column
1262+
* and has a unique index.
1263+
*
1264+
* @ORM\Column(name="email_address", unique="true", length="150")
1265+
*/
1266+
protected $email;
1267+
1268+
.. code-block:: yaml
1269+
1270+
fields:
1271+
# A string field length 255 that cannot be null
1272+
# (reflecting the default values for the "length" and *nullable* options)
1273+
# type attribute is necessary in yaml definitions
1274+
name:
1275+
type: string
1276+
1277+
# A string field of length 150 that persists to an "email_address" column
1278+
# and has a unique index.
1279+
email:
1280+
type: string
1281+
column: email_address
1282+
length: 150
1283+
unique: true
12651284
12661285
.. note::
12671286

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.