{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-expressive/issues/619","repository_url":"https://api.github.com/repos/zendframework/zend-expressive","labels_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/619/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/619/comments","events_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/619/events","html_url":"https://github.com/zendframework/zend-expressive/pull/619","id":328980309,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMzUwNjY5","number":619,"title":"Add middlewareName getter to LazyLoadingMiddleware","user":{"login":"robopuff","id":730047,"node_id":"MDQ6VXNlcjczMDA0Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/730047?v=4","gravatar_id":"","url":"https://api.github.com/users/robopuff","html_url":"https://github.com/robopuff","followers_url":"https://api.github.com/users/robopuff/followers","following_url":"https://api.github.com/users/robopuff/following{/other_user}","gists_url":"https://api.github.com/users/robopuff/gists{/gist_id}","starred_url":"https://api.github.com/users/robopuff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robopuff/subscriptions","organizations_url":"https://api.github.com/users/robopuff/orgs","repos_url":"https://api.github.com/users/robopuff/repos","events_url":"https://api.github.com/users/robopuff/events{/privacy}","received_events_url":"https://api.github.com/users/robopuff/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-04T09:38:12Z","updated_at":"2018-06-04T13:44:55Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/zendframework/zend-expressive/pulls/619","html_url":"https://github.com/zendframework/zend-expressive/pull/619","diff_url":"https://github.com/zendframework/zend-expressive/pull/619.diff","patch_url":"https://github.com/zendframework/zend-expressive/pull/619.patch"},"body":"In some cases it is necessary to get a middleware name that is corresponding to the route and since that was possible to do in previous versions of Expressive, it would be nice to keep that functionality.\r\nWe are currently using input filters written in config files and they are maintained by middleware class name and currently only possible way of doing that is by overriding closure."},"comment":{"url":"https://api.github.com/repos/zendframework/zend-expressive/issues/comments/394359719","html_url":"https://github.com/zendframework/zend-expressive/pull/619#issuecomment-394359719","issue_url":"https://api.github.com/repos/zendframework/zend-expressive/issues/619","id":394359719,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDM1OTcxOQ==","user":{"login":"weierophinney","id":25943,"node_id":"MDQ6VXNlcjI1OTQz","avatar_url":"https://avatars1.githubusercontent.com/u/25943?v=4","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"created_at":"2018-06-04T13:44:55Z","updated_at":"2018-06-04T13:44:55Z","author_association":"MEMBER","body":"I don't think this is going to do what you think it will.\r\n\r\nWhat happens if:\r\n\r\n- a delegator wraps the middleware in a `MiddlewarePipe`?\r\n- a delegator _replaces_ the middleware entirely?\r\n\r\nAdditionally, where exactly would you have access to the lazy-loading middleware? Generally speaking, the only classes that have direct access to it are the router, and potentially the dispatch middleware. You _might_ have access to it from the `RouteResult`, _but only if neither of the previous two scenarios occur_.\r\n\r\nI honestly think you would be better served by using the route _name_ matched, and not the middleware; alternately, use a construct like this:\r\n\r\n```php\r\n$app->post('/api/some/endpoint', [\r\n    inputValidatorMiddlewareFactory(Endpoint::class),\r\n    Endpoint::class,\r\n], 'endpoint');\r\n```\r\n\r\n(Where the `inputValidatorMiddlewareFactory` likely has access to the input filter plugin manager and/or the `MiddlewareFactory`.)\r\n\r\nThe above approach ensures the input filter is created and consumed regardless of what substitutions occur for `Endpoint`."}}
{"actor":{"display_login":"weierophinney"}}