Skip to content

Commit

Permalink
Fix section headers in orm doc (#157)
Browse files Browse the repository at this point in the history
remove manual numbers; improved hierarchy
  • Loading branch information
dmarkowicz authored and core23 committed Mar 11, 2017
1 parent 1cb350d commit baed831
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions Resources/doc/reference/orm.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
=============================
Translate Doctrine ORM models
=============================

A. Using Gedmo Doctrine Extensions
----------------------------------
Scenario A - Using Gedmo Doctrine Extensions
============================================

Doctrine ORM models translations are handled by `Gedmo translatable extension`_.

Expand All @@ -11,8 +12,8 @@ Gedmo has two ways to handle translations.
Either everything is saved in a unique table, this is easier to set up but can lead to bad performance if your project
grows or it can have one translation table for every model table. This second way is called personal translation.

1. Implement the TranslatableInterface
--------------------------------------
Implement the TranslatableInterface
-----------------------------------

First step, your entities have to implement the `TranslatableInterface`_.

Expand All @@ -22,13 +23,13 @@ Depends on how you want to save translations you can choose between :
* `Sonata\TranslationBundle\Model\Gedmo\AbstractTranslatable`
* `Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable`

2. Define translatable Fields
-----------------------------
Define translatable Fields
--------------------------

Please check the docs in the `Gedmo translatable documentation`_.

2.1 Example using Personal Translation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example using Personal Translation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: php
Expand Down Expand Up @@ -100,8 +101,8 @@ Please check the docs in the `Gedmo translatable documentation`_.
* `Sonata\TranslationBundle\Traits\TranslatableTrait`
* `Sonata\TranslationBundle\Traits\PersonalTranslatableTrait`

2.2 Example using Personal Translation with Traits
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example using Personal Translation with Traits
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: php
Expand Down Expand Up @@ -137,14 +138,14 @@ Please check the docs in the `Gedmo translatable documentation`_.
// ...
}
3. Define your translation Table
--------------------------------
Define your translation Table
-----------------------------

**This step is optional**, but if you choose Personal Translation,
you have to make a translation class to handle it.

3.1 Example for translation class for Personal Translation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example for translation class for Personal Translation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: php
Expand Down Expand Up @@ -173,14 +174,14 @@ you have to make a translation class to handle it.
protected $object;
}
4. Configure search filter
--------------------------
Configure search filter
-----------------------

**This step is optional**, but you can use the ``doctrine_orm_translation_field``
filter to search on fields and on their translations.

4.1 Example for configure search filter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Example for configure search filter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: php
Expand All @@ -207,11 +208,11 @@ filter to search on fields and on their translations.
->add('title', TranslationFieldFilter::class); // or 'doctrine_orm_translation_field'
}
B. Using KnpLabs Doctrine Behaviours
------------------------------------
Scenario B - Using KnpLabs Doctrine Behaviours
==============================================

1. Implement TranslatableInterface
----------------------------------
Implement TranslatableInterface
-------------------------------

Your entities have to implement `Model\TranslatableInterface <https://github.com/sonata-project/SonataTranslationBundle/blob/master/Model/TranslatableInterface.php>`_.

Expand Down Expand Up @@ -318,8 +319,8 @@ Your entities need to explicitly implement getter and setter methods for the knp
}
2. Define your translation table
--------------------------------
Define your translation table
-----------------------------

Please refer to `KnpLabs Doctrine2 Behaviors Documentation <https://github.com/KnpLabs/DoctrineBehaviors#translatable>`_.

Expand Down

0 comments on commit baed831

Please sign in to comment.