From e0698a93398372782f3efe44f461cfa4b800cacc Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 2 Oct 2014 16:49:28 +0200 Subject: [PATCH] Update database.rst --- developer_manual/app/database.rst | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/developer_manual/app/database.rst b/developer_manual/app/database.rst index 06f71bbc2..2580ce68a 100644 --- a/developer_manual/app/database.rst +++ b/developer_manual/app/database.rst @@ -223,6 +223,48 @@ Since all attributes should be protected, getters and setters are automatically $author->setId(3); $author->getPhoneNumber() // null +Custom attribute to database column mapping +------------------------------------------- + +By default each attribute will be mapped to a database column by a certain convention, e.g. **phoneNumber** +will be mapped to the column **phone_number** and vice versa. Sometimes it is needed though to map attributes to +different columns because of backwards compability. To define a custom +mapping, simply override the **columnToProperty** and **propertyToColumn** methods of the entity in question: + +.. code-block:: php + + +