{"action":"created","issue":{"url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/issues/26","labels_url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/issues/26/comments","events_url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/issues/26/events","html_url":"https://github.com/sonata-project/SonataTranslationBundle/pull/26","id":55479223,"number":26,"title":"Add support for knplabs doctrine behaviors","user":{"login":"almacbe","id":21765,"avatar_url":"https://avatars.githubusercontent.com/u/21765?v=3","gravatar_id":"","url":"https://api.github.com/users/almacbe","html_url":"https://github.com/almacbe","followers_url":"https://api.github.com/users/almacbe/followers","following_url":"https://api.github.com/users/almacbe/following{/other_user}","gists_url":"https://api.github.com/users/almacbe/gists{/gist_id}","starred_url":"https://api.github.com/users/almacbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almacbe/subscriptions","organizations_url":"https://api.github.com/users/almacbe/orgs","repos_url":"https://api.github.com/users/almacbe/repos","events_url":"https://api.github.com/users/almacbe/events{/privacy}","received_events_url":"https://api.github.com/users/almacbe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-26T12:56:21Z","updated_at":"2015-08-18T09:09:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/pulls/26","html_url":"https://github.com/sonata-project/SonataTranslationBundle/pull/26","diff_url":"https://github.com/sonata-project/SonataTranslationBundle/pull/26.diff","patch_url":"https://github.com/sonata-project/SonataTranslationBundle/pull/26.patch"},"body":"I add support for [KnpLabsDoctrineBehaviors](https://github.com/KnpLabs/DoctrineBehaviors).\r\nThere is a few things that it has to be careful:\r\n* Entity that want to be translatable, it has to implement **Sonata\\TranslationBundle\\Model\\TranslatableInterface**\r\n* Translatable entity has to implement get and set methods with this formar because magic method doesnt work (https://github.com/KnpLabs/DoctrineBehaviors#proxy-translations). The explination and solution for that, you can find it in this [post](http://thewebmason.com/tutorial-using-sonata-admin-with-magic-__call-method/)\r\n```php\r\n...\r\nclass TranslatableEntity implements TranslatableInterface\r\n    {\r\n    use ORMBehaviors\\Translatable\\Translatable;\r\n\r\n    /**\r\n     * @var integer\r\n     *\r\n     * @ORM\\Column(name=\"id\", type=\"integer\")\r\n     * @ORM\\Id\r\n     * @ORM\\GeneratedValue(strategy=\"AUTO\")\r\n     */\r\n    private $id;\r\n...\r\n    public function getName()\r\n    {\r\n        return $this->translate()->getName();\r\n    }\r\n\r\n    public function setName($name)\r\n    {\r\n        $this->translate()->setName($name);\r\n    }\r\n...\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/issues/comments/132127735","html_url":"https://github.com/sonata-project/SonataTranslationBundle/pull/26#issuecomment-132127735","issue_url":"https://api.github.com/repos/sonata-project/SonataTranslationBundle/issues/26","id":132127735,"user":{"login":"Soullivaneuh","id":1698357,"avatar_url":"https://avatars.githubusercontent.com/u/1698357?v=3","gravatar_id":"","url":"https://api.github.com/users/Soullivaneuh","html_url":"https://github.com/Soullivaneuh","followers_url":"https://api.github.com/users/Soullivaneuh/followers","following_url":"https://api.github.com/users/Soullivaneuh/following{/other_user}","gists_url":"https://api.github.com/users/Soullivaneuh/gists{/gist_id}","starred_url":"https://api.github.com/users/Soullivaneuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soullivaneuh/subscriptions","organizations_url":"https://api.github.com/users/Soullivaneuh/orgs","repos_url":"https://api.github.com/users/Soullivaneuh/repos","events_url":"https://api.github.com/users/Soullivaneuh/events{/privacy}","received_events_url":"https://api.github.com/users/Soullivaneuh/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T09:09:09Z","updated_at":"2015-08-18T09:09:09Z","body":"@almacbe Please rebase your PR to get new Travis checks."}}