{"action":"opened","issue":{"url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/79","labels_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/79/comments","events_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/79/events","html_url":"https://github.com/zendframework/zend-inputfilter/issues/79","id":118276797,"number":79,"title":"Input Filter Factory uses a different FilterPluginManager instance","user":{"login":"ffraenz","id":1041468,"avatar_url":"https://avatars.githubusercontent.com/u/1041468?v=3","gravatar_id":"","url":"https://api.github.com/users/ffraenz","html_url":"https://github.com/ffraenz","followers_url":"https://api.github.com/users/ffraenz/followers","following_url":"https://api.github.com/users/ffraenz/following{/other_user}","gists_url":"https://api.github.com/users/ffraenz/gists{/gist_id}","starred_url":"https://api.github.com/users/ffraenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ffraenz/subscriptions","organizations_url":"https://api.github.com/users/ffraenz/orgs","repos_url":"https://api.github.com/users/ffraenz/repos","events_url":"https://api.github.com/users/ffraenz/events{/privacy}","received_events_url":"https://api.github.com/users/ffraenz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-22T17:40:17Z","updated_at":"2015-11-22T17:40:17Z","closed_at":null,"body":"I created a custom filter which needs dependency injection by a factory. I added the filter to the config array like so:\r\n\r\n```php\r\nreturn  [\r\n    'filters' => [\r\n        'factories' => [\r\n            'ToFile' => 'Module\\Factory\\Filter\\ToFile',\r\n        ],\r\n    ],\r\n];\r\n```\r\n\r\nI am able to get a filter instance from the `FilterPluginManager` inside a controller:\r\n\r\n```php\r\n$filter = $this->getServiceLocator()->get('FilterManager')->get('ToFile');\r\nvar_dump($filter);\r\n```\r\n\r\nInside the `init()` method of a class extending `Zend\\Form\\Form` I configured an input filter using the custom filter. The form also uses custom form elements from the `FormElementManager`.\r\n\r\n```php\r\n$this->getInputFilter()->add([\r\n    'name' => 'file',\r\n    'required' => false,\r\n    'filters' => [\r\n        [ 'name' => 'ToFile' ],\r\n    ],\r\n]);\r\n```\r\n\r\nCustom form elements are working fine but the custom filter always raises a `ServiceNotFoundException`:\r\n\r\n    Zend\\Filter\\FilterPluginManager::get was unable to fetch or create an instance for ToFile\r\n\r\nI found out that the Input Filter Factory is using a different `FilterPluginManager` instance which has never seen the config array. The custom filter with its factory is not included in the plugin manager.\r\n\r\nThis is unexpected behaviour? Or am I wrong?"}}