{"action":"created","issue":{"url":"https://api.github.com/repos/slimphp/Slim/issues/2240","repository_url":"https://api.github.com/repos/slimphp/Slim","labels_url":"https://api.github.com/repos/slimphp/Slim/issues/2240/labels{/name}","comments_url":"https://api.github.com/repos/slimphp/Slim/issues/2240/comments","events_url":"https://api.github.com/repos/slimphp/Slim/issues/2240/events","html_url":"https://github.com/slimphp/Slim/issues/2240","id":234934743,"number":2240,"title":"Setting nested-array values in Container and Collection","user":{"login":"johnrobertporter","id":26965212,"avatar_url":"https://avatars0.githubusercontent.com/u/26965212?v=4","gravatar_id":"","url":"https://api.github.com/users/johnrobertporter","html_url":"https://github.com/johnrobertporter","followers_url":"https://api.github.com/users/johnrobertporter/followers","following_url":"https://api.github.com/users/johnrobertporter/following{/other_user}","gists_url":"https://api.github.com/users/johnrobertporter/gists{/gist_id}","starred_url":"https://api.github.com/users/johnrobertporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnrobertporter/subscriptions","organizations_url":"https://api.github.com/users/johnrobertporter/orgs","repos_url":"https://api.github.com/users/johnrobertporter/repos","events_url":"https://api.github.com/users/johnrobertporter/events{/privacy}","received_events_url":"https://api.github.com/users/johnrobertporter/received_events","type":"User","site_admin":false},"labels":[{"id":279496120,"url":"https://api.github.com/repos/slimphp/Slim/labels/question","name":"question","color":"5319e7","default":true},{"id":210765075,"url":"https://api.github.com/repos/slimphp/Slim/labels/Slim%203","name":"Slim 3","color":"009800","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-06-09T20:46:20Z","updated_at":"2017-07-28T11:00:46Z","closed_at":"2017-07-26T14:26:05Z","body":"(FYI, this is @designermonkey on another account, sorry)\r\n\r\nBecause of the way a project I am on is using environment config loading (.env), I have had to make minor modifications to the settings for Slim.\r\n\r\nThe test below highlights the change:\r\n\r\n```php\r\n    /**\r\n     * Test settings can be edited\r\n     */\r\n    public function testSettingsCanBeEdited()\r\n    {\r\n        $this->assertSame('1.1', $this->container->get('settings')['slim']['http_version']);\r\n\r\n        $this->container->get('settings')['slim']['http_version'] = '1.2';\r\n        $this->assertSame('1.2', $this->container->get('settings')['slim']['http_version']);\r\n    }\r\n```\r\n\r\nAs you can see, there is an extra level to isolate Slim settings from others within the app. Because of this change, the test fails with:\r\n\r\n> Indirect modification of overloaded element of Slim\\Collection has no effect\r\n\r\nThis is due to the weird and wonderful way that Collection accesses it's values internally.\r\n\r\nMany moons ago (at least two years if I remember right) we had this issue before, long before the introduction of the current container and collection structure, and I'm sure we solved it back then.\r\n\r\nCan anyone think of how we could tackle this issue?\r\n\r\nIrrespective of my alterations which have only highlighted the issue, we have prevented any way of having alterations made to nested settings without a horrible amount of extra code for the developer in getting from the container, getting from the collection, setting into the collection and then setting into the container.\r\n"},"comment":{"url":"https://api.github.com/repos/slimphp/Slim/issues/comments/318624175","html_url":"https://github.com/slimphp/Slim/issues/2240#issuecomment-318624175","issue_url":"https://api.github.com/repos/slimphp/Slim/issues/2240","id":318624175,"user":{"login":"johnrobertporter","id":26965212,"avatar_url":"https://avatars0.githubusercontent.com/u/26965212?v=4","gravatar_id":"","url":"https://api.github.com/users/johnrobertporter","html_url":"https://github.com/johnrobertporter","followers_url":"https://api.github.com/users/johnrobertporter/followers","following_url":"https://api.github.com/users/johnrobertporter/following{/other_user}","gists_url":"https://api.github.com/users/johnrobertporter/gists{/gist_id}","starred_url":"https://api.github.com/users/johnrobertporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnrobertporter/subscriptions","organizations_url":"https://api.github.com/users/johnrobertporter/orgs","repos_url":"https://api.github.com/users/johnrobertporter/repos","events_url":"https://api.github.com/users/johnrobertporter/events{/privacy}","received_events_url":"https://api.github.com/users/johnrobertporter/received_events","type":"User","site_admin":false},"created_at":"2017-07-28T11:00:46Z","updated_at":"2017-07-28T11:00:46Z","body":"@geggleto this doesn't deal with the crux of the issue though.\r\n\r\n>Indirect modification of overloaded element of Slim\\Collection has no effect\r\n\r\nYou can't modify nested values. This is something we need to fix, not make people code around.\r\n\r\nI hope with the invent of Slim4, we find a better way of handling this."}}
{"actor":{"display_login":"johnrobertporter"}}