Skip to content

Commit

Permalink
Add missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Hristov committed Jan 3, 2018
1 parent 749031b commit 94fdb9d
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class NewsTranslation implements Translation
/**
* @param News $translatable
*/
public function setTranslatable(News $translatable)
public function setTranslatable(News $translatable = null)
{
$this->translatable = $translatable;
}
Expand Down Expand Up @@ -341,6 +341,30 @@ doctrine:
resolve_target_entities:
VM5\EntityTranslationsBundle\Model\Language: Example\Language
```
Translatable should have `addTranslation`, `removeTranslation` (
see <a href="https://symfony.com/doc/current/reference/forms/types/collection.html#by-reference" target="_blank">by-reference</a>
and
<a href="https://symfony.com/doc/current/doctrine/associations.html" target="_blank">How to Work with Doctrine Associations / Relations</a>
):

```php
public function addTranslation(NewsTranslation $translation)
{
if (!$this->translations->contains($translation)) {
$this->translations->add($translation);
$translation->setTranslatable($this);
}
}
public function removeTranslation(NewsTranslation $translation)
{
$this->translations->removeElement($translation);
$translation->setTranslatable(null);
}
```
Translation should implements `EditableTranslation` instead of simple `Translation`

```php
Expand Down

0 comments on commit 94fdb9d

Please sign in to comment.