From 961bff6a80a189ab32f931a0cfede6204528cbb2 Mon Sep 17 00:00:00 2001 From: Adam Prager Date: Mon, 27 Apr 2015 17:23:40 +0200 Subject: [PATCH] Initializing embeddables doc --- docs/en/tutorials/embeddables.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/en/tutorials/embeddables.rst b/docs/en/tutorials/embeddables.rst index 60265d6d5..681aa7536 100644 --- a/docs/en/tutorials/embeddables.rst +++ b/docs/en/tutorials/embeddables.rst @@ -76,6 +76,20 @@ In terms of your database schema, Doctrine will automatically inline all columns from the ``Address`` class into the table of the ``User`` class, just as if you had declared them directly there. +Initializing embeddables +------------------------ + +In case all fields in the embeddable are ``nullable``, you might want +to initialize the embeddable, to avoid getting a null value instead of +the embedded object. + +.. code-block:: php + + public function __construct() + { + $this->address = new Address(); + } + Column Prefixing ----------------