diff --git a/en/index.rst b/en/index.rst index e6e90f179..f066b5bc3 100644 --- a/en/index.rst +++ b/en/index.rst @@ -93,6 +93,7 @@ Tutorials * :doc:`Composite Primary Keys ` * :doc:`Ordered associations ` * :doc:`Pagination ` + * :doc:`Override Mappings With Annotations ` Cookbook -------- diff --git a/en/toc.rst b/en/toc.rst index 5cdbe90c7..9e9edd744 100644 --- a/en/toc.rst +++ b/en/toc.rst @@ -13,6 +13,7 @@ Tutorials tutorials/composite-primary-keys tutorials/ordered-associations tutorials/in-ten-quick-steps + tutorials/override-mappings-with-annotations Reference Guide --------------- diff --git a/en/tutorials/override-mappings-with-annotations.rst b/en/tutorials/override-mappings-with-annotations.rst new file mode 100644 index 000000000..eaf316213 --- /dev/null +++ b/en/tutorials/override-mappings-with-annotations.rst @@ -0,0 +1,88 @@ +Override Mappings With Annotations +---------------------------------- + +Sometimes there is a need to persist entities but override all or part of the +mapping metadata. Sometimes also the mapping to override comes from entities +using traits where the traits have mapping metadata. +This tutorial explains how to override mapping metadata, +i.e. attributes and associations metadata in particular. The example here shows +the overriding of a class that uses a trait but is similar when extending a base +class as shown at the end of this tutorial. + +Suppose we have a class ExampleEntityWithOverride. This class uses trait ExampleTrait: + +.. code-block:: php + +