Skip to content

Commit

Permalink
Removed types list
Browse files Browse the repository at this point in the history
This is really doctrine specific, the sf docs should not document this,
kind of SoC for docs 😉.
  • Loading branch information
wouterj committed Jan 18, 2014
1 parent c95a68d commit 88aa347
Showing 1 changed file with 2 additions and 100 deletions.
102 changes: 2 additions & 100 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1351,106 +1351,8 @@ Doctrine Field Types Reference

Doctrine comes with a large number of field types available. Each of these
maps a PHP data type to a specific column type in whatever database you're
using. The following types are supported in Doctrine:

* **Strings**

* ``string`` (used for shorter strings)
* ``text`` (used for larger strings)

* **Numbers**

* ``integer``
* ``smallint``
* ``bigint``
* ``decimal``
* ``float``

* **Dates and Times** (use a `DateTime`_ object for these fields in PHP)

* ``date``
* ``time``
* ``datetime``
* ``datetimetz``

* **Other Types**

* ``boolean``
* ``object`` (serialized and stored in a ``CLOB`` field)
* ``array`` (serialized and stored in a ``CLOB`` field)
* ``blob`` (mapped to a resource stream)
* ``simple_array`` (serialized using :phpfunction:`implode()` and :phpfunction:`explode()`,
with a comma as delimiter, and stored in a ``CLOB`` field)
* ``json_array`` (serialized using :phpfunction:`json_encode()` and :phpfunction:`json_decode()`,
and stored in a ``CLOB`` field)
* ``guid``

For more information, see Doctrine's `Mapping Types documentation`_.

Field Options
~~~~~~~~~~~~~

Each field can have a set of options applied to it. The available options
include ``type`` (defaults to ``string``), ``name``, ``length``, ``unique``
and ``nullable``. Take a few examples:

.. configuration-block::

.. code-block:: php-annotations
/**
* A string field with length 255 that cannot be null
* (reflecting the default values for the "type", "length"
* and *nullable* options)
*
* @ORM\Column()
*/
protected $name;
/**
* A string field of length 150 that persists to an "email_address" column
* and has a unique index.
*
* @ORM\Column(name="email_address", unique=true, length=150)
*/
protected $email;
.. code-block:: yaml
fields:
# A string field length 255 that cannot be null
# (reflecting the default values for the "length" and *nullable* options)
# type attribute is necessary in YAML definitions
name:
type: string
# A string field of length 150 that persists to an "email_address" column
# and has a unique index.
email:
type: string
column: email_address
length: 150
unique: true
.. code-block:: xml
<!--
A string field length 255 that cannot be null
(reflecting the default values for the "length" and *nullable* options)
type attribute is necessary in XML definitions
-->
<field name="name" type="string" />
<field name="email"
type="string"
column="email_address"
length="150"
unique="true"
/>
.. note::

There are a few more options not listed here. For more details, see
Doctrine's `Property Mapping documentation`_
using. To see a list of all available types and more information, see
Doctrine's `Mapping Types documentation`_.

.. index::
single: Doctrine; ORM console commands
Expand Down

0 comments on commit 88aa347

Please sign in to comment.