{"action":"created","issue":{"url":"https://api.github.com/repos/Sylius/Sylius/issues/6157","repository_url":"https://api.github.com/repos/Sylius/Sylius","labels_url":"https://api.github.com/repos/Sylius/Sylius/issues/6157/labels{/name}","comments_url":"https://api.github.com/repos/Sylius/Sylius/issues/6157/comments","events_url":"https://api.github.com/repos/Sylius/Sylius/issues/6157/events","html_url":"https://github.com/Sylius/Sylius/issues/6157","id":177827946,"number":6157,"title":"Extend StaticContent class","user":{"login":"belaustegui","id":2965623,"avatar_url":"https://avatars.githubusercontent.com/u/2965623?v=3","gravatar_id":"","url":"https://api.github.com/users/belaustegui","html_url":"https://github.com/belaustegui","followers_url":"https://api.github.com/users/belaustegui/followers","following_url":"https://api.github.com/users/belaustegui/following{/other_user}","gists_url":"https://api.github.com/users/belaustegui/gists{/gist_id}","starred_url":"https://api.github.com/users/belaustegui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/belaustegui/subscriptions","organizations_url":"https://api.github.com/users/belaustegui/orgs","repos_url":"https://api.github.com/users/belaustegui/repos","events_url":"https://api.github.com/users/belaustegui/events{/privacy}","received_events_url":"https://api.github.com/users/belaustegui/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-19T16:11:57Z","updated_at":"2016-09-19T16:20:32Z","closed_at":"2016-09-19T16:20:32Z","body":"I'm trying to extend the SymfonyContentBundle StaticContent class. I've been looking at issue #5301 but I can not make it succeed.\r\n\r\nWhat I have right now is:\r\n\r\n```php\r\n# src/AppBundle/Document/StaticContent.php\r\n<?php\r\n\r\nnamespace AppBundle\\Document;\r\n\r\nuse Sylius\\Component\\Resource\\Model\\ResourceInterface;\r\nuse Sylius\\Bundle\\ContentBundle\\Document\\StaticContent as SyliusStaticContent;\r\n\r\nclass StaticContent extends SyliusStaticContent implements ResourceInterface\r\n{\r\n  public function testMethod() {\r\n    return \"this is my test method\";\r\n  }\r\n}\r\n```\r\n\r\n```yml\r\n# app/config.yml\r\nsylius_content:\r\n    driver: doctrine/phpcr-odm\r\n    resources:\r\n        static_content:\r\n            classes:\r\n                model: AppBundle\\Document\\StaticContent\r\n```\r\n\r\n\r\n```xml\r\n# src/AppBundle/Resources/config/doctrine/StaticContent.phpcr.xml\r\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n\r\n<doctrine-mapping\r\n        xmlns=\"http://doctrine-project.org/schemas/phpcr-odm/phpcr-mapping\"\r\n        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n        xsi:schemaLocation=\"http://doctrine-project.org/schemas/phpcr-odm/phpcr-mapping\r\n                            https://github.com/doctrine/phpcr-odm/raw/master/doctrine-phpcr-odm-mapping.xsd\"\r\n>\r\n\r\n    <document name=\"AppBundle\\Document\\StaticContent\" />\r\n\r\n</doctrine-mapping>\r\n```\r\n\r\nUnfortunately, when I load a StaticContent object, it is now from my extended class:\r\n\r\n```shell\r\n$ php app/console psysh\r\n\r\nPsy Shell v0.7.2 (PHP 5.6.25-2+deb.sury.org~xenial+1 — cli) by Justin Hileman\r\n>>> $dm = $container->get(\"doctrine_phpcr.odm.default_document_manager\")\r\n=> Doctrine\\ODM\\PHPCR\\DocumentManager {#14005\r\n     +\"valueConverter\": PHPCR\\Util\\ValueConverter {#12219},\r\n   }\r\n\r\n>>> $page = $dm->find(null, \"/cms/pages/pagina-de-prueba\")\r\n=> Sylius\\Bundle\\ContentBundle\\Document\\StaticContent {#11420}\r\n```\r\n\r\nAm I missing something?"},"comment":{"url":"https://api.github.com/repos/Sylius/Sylius/issues/comments/248041306","html_url":"https://github.com/Sylius/Sylius/issues/6157#issuecomment-248041306","issue_url":"https://api.github.com/repos/Sylius/Sylius/issues/6157","id":248041306,"user":{"login":"belaustegui","id":2965623,"avatar_url":"https://avatars.githubusercontent.com/u/2965623?v=3","gravatar_id":"","url":"https://api.github.com/users/belaustegui","html_url":"https://github.com/belaustegui","followers_url":"https://api.github.com/users/belaustegui/followers","following_url":"https://api.github.com/users/belaustegui/following{/other_user}","gists_url":"https://api.github.com/users/belaustegui/gists{/gist_id}","starred_url":"https://api.github.com/users/belaustegui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/belaustegui/subscriptions","organizations_url":"https://api.github.com/users/belaustegui/orgs","repos_url":"https://api.github.com/users/belaustegui/repos","events_url":"https://api.github.com/users/belaustegui/events{/privacy}","received_events_url":"https://api.github.com/users/belaustegui/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T16:20:32Z","updated_at":"2016-09-19T16:20:32Z","body":"Turns out that I had to execute a class migration.\r\n\r\n```shell\r\nphp app/console doctrine:phpcr:document:migrate-class \"Sylius\\Bundle\\ContentBundle\\Document\\StaticContent\" \"AppBundle\\Document\\StaticContent\"\r\n```"}}
{"actor":{"display_login":"belaustegui"}}