diff --git a/README.md b/README.md index 7ccb599..5af2cdc 100644 --- a/README.md +++ b/README.md @@ -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; } @@ -341,6 +341,30 @@ doctrine: resolve_target_entities: VM5\EntityTranslationsBundle\Model\Language: Example\Language ``` + +Translatable should have `addTranslation`, `removeTranslation` ( +see by-reference +and +How to Work with Doctrine Associations / Relations +): + +```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