{"action":"closed","issue":{"url":"https://api.github.com/repos/nextras/orm/issues/128","labels_url":"https://api.github.com/repos/nextras/orm/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/nextras/orm/issues/128/comments","events_url":"https://api.github.com/repos/nextras/orm/issues/128/events","html_url":"https://github.com/nextras/orm/issues/128","id":112653719,"number":128,"title":"Property container factory","user":{"login":"Mikulas","id":192200,"avatar_url":"https://avatars.githubusercontent.com/u/192200?v=3","gravatar_id":"","url":"https://api.github.com/users/Mikulas","html_url":"https://github.com/Mikulas","followers_url":"https://api.github.com/users/Mikulas/followers","following_url":"https://api.github.com/users/Mikulas/following{/other_user}","gists_url":"https://api.github.com/users/Mikulas/gists{/gist_id}","starred_url":"https://api.github.com/users/Mikulas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mikulas/subscriptions","organizations_url":"https://api.github.com/users/Mikulas/orgs","repos_url":"https://api.github.com/users/Mikulas/repos","events_url":"https://api.github.com/users/Mikulas/events{/privacy}","received_events_url":"https://api.github.com/users/Mikulas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nextras/orm/labels/1-discussion","name":"1-discussion","color":"fbca04"},{"url":"https://api.github.com/repos/nextras/orm/labels/3-priority-low","name":"3-priority-low","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-10-21T18:44:11Z","updated_at":"2015-10-22T09:36:46Z","closed_at":"2015-10-22T09:36:46Z","body":"I'm refactoring implementation of postgres composite types in our app for the third time. Final solution I've arrived at is generic `PostgresCompositeType` class that can parse and be serialized into pg composite type. Those are linked with `IEntities` via `PostgresTypePropertyProxy` which implements `IPropertyContainer`. \r\n\r\nThis `PostgresTypePropertyProxy` is same of all properties, but differs in which internal class it uses, which is set via constructor.\r\n\r\n`AbstractEntity::initProperty` does not know what type it needs to create container with, so I though I would do something alongside those lines:\r\n```\r\nfunction __construct() {\r\n    parent::__construct();\r\n    $this->address = new PostgresTypePropertyProxy($this, $this->getMetadata()->getProperty('address'), AddressType::class);\r\n}\r\n```\r\n\r\nhowever, this a/ does obviously not work, b/ but neither does `setRawValue` (which sets raw value of container, not the value one level above, which I need), c/ would be smelly anyway as the first container would be overwritten immediately.\r\n\r\nWhat solutions I though of:\r\n- [ ] ease `AbstractEntity::initProperty` visibility to `protected` (simple)\r\n- [ ] replace `new $class()`  in `initProperty` with call to injected property container factory (clean, but quite involved)\r\n- [ ] replace `new $class()`  in `initProperty` with call to protected method that would by default do the same as now (clean, simple)"}}