{"action":"opened","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/11629","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/11629/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/11629/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/11629/events","html_url":"https://github.com/magento/magento2/issues/11629","id":267456154,"number":11629,"title":"Problem with observer class not found","user":{"login":"ad1rie1","id":1949622,"avatar_url":"https://avatars3.githubusercontent.com/u/1949622?v=4","gravatar_id":"","url":"https://api.github.com/users/ad1rie1","html_url":"https://github.com/ad1rie1","followers_url":"https://api.github.com/users/ad1rie1/followers","following_url":"https://api.github.com/users/ad1rie1/following{/other_user}","gists_url":"https://api.github.com/users/ad1rie1/gists{/gist_id}","starred_url":"https://api.github.com/users/ad1rie1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ad1rie1/subscriptions","organizations_url":"https://api.github.com/users/ad1rie1/orgs","repos_url":"https://api.github.com/users/ad1rie1/repos","events_url":"https://api.github.com/users/ad1rie1/events{/privacy}","received_events_url":"https://api.github.com/users/ad1rie1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-22T11:14:36Z","updated_at":"2017-10-22T11:14:36Z","closed_at":null,"author_association":"NONE","body":"<!--- Provide a general summary of the issue in the Title above -->\r\n<!--- Before adding new issues, please, check this article https://github.com/magento/magento2/wiki/Issue-reporting-guidelines-->\r\n\r\n### Preconditions\r\n<!--- Provide a more detailed information of environment you use -->\r\n<!--- Magento version, tag, HEAD, etc., PHP & MySQL version, etc.. -->\r\n1. Magento 2.1.9\r\n2. Php 7.0\r\n\r\n### Steps to reproduce\r\n<!--- Provide a set of unambiguous steps to reproduce this bug include code, if relevant  -->\r\nLike your documentation i have created a module for redirect user. \r\nThe directory is : \r\n**/app/code/Athena/RedirectToLanguage/etc/frontend/events.xml :** \r\n<?xml version=\"1.0\"?>\r\n<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Event/etc/events.xsd\">\r\n    <event name='controller_action_predispatch'>\r\n                <observer\r\n                        name='Athena_language_redirector'\r\n                        instance='Athena\\RedirectToLanguage\\Observer\\AthenaObserverRedirect'\r\n                />\r\n    </event>\r\n</config>\r\n\r\n**/app/code/Athena/RedirectToLanguage/Observer/AthenaObserverRedirect :**\r\n<?php\r\nnamespace Athena\\RedirectToLanguage\\Observer;\r\nuse Magento\\Framework\\Event\\Observer;\r\nuse Magento\\Framework\\Event\\ObserverInterface;\r\n\r\nclass AthenaObserverRedirect implements ObserverInterface {\r\n    protected $_responseFactory;\r\n    protected $_url;\r\n\r\n    public function __construct(\r\n\r\n        \\Magento\\Framework\\App\\ResponseFactory $responseFactory,\r\n        \\Magento\\Framework\\UrlInterface $url\r\n    ) {\r\n        $this->_responseFactory = $responseFactory;\r\n        $this->_url = $url;\r\n    }\r\n\r\n    public function execute(Observer $observer) {\r\n            $category = $observer->getEvent()->getCategory();\r\n            $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);\r\n            $FRStoreUrl = \"https://www.athena-computing.fr/fr\";\r\n            $EnRedirectUrl = \"https://www.athena-computing.fr/en\";\r\n            switch ($lang){\r\n                case \"fr\":\r\n                 $this->_responseFactory->create()->setRedirect($FRStoreUrl)->sendResponse();\r\n                    break;\r\n                case \"en\":\r\n                  $this->_responseFactory->create()->setRedirect($EnRedirectUrl)->sendResponse();\r\n                    break;\r\n                default:\r\n                    $this->_responseFactory->create()->setRedirect($EnRedirectUrl)->sendResponse()\r\n                    break;\r\n    }\r\n            $this->_responseFactory->create()->setRedirect($RedirectUrl)->sendResponse();\r\nexit();\r\n\r\n    }\r\n}\r\n\r\n**/app/code/Athena/RedirectToLanguage/registration.php:**\r\n<?php\r\n \r\n\\Magento\\Framework\\Component\\ComponentRegistrar::register(\r\n    \\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,\r\n    'Athena_RedirectToLanguage',\r\n    __DIR__\r\n);\r\n\r\n**/app/code/Athena/RedirectToLanguage/etc/module.xml:**\r\n\r\n<?xml version=\"1.0\"?>\r\n<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Module/etc/module.xsd\">\r\n    <module name=\"Athena_RedirectToLanguage\" setup_version=\"1.0.0\">\r\n    </module>\r\n</config>\r\n\r\nAll the console php bin/magento setup:upgrade works fine, i see the new module. \r\nBut when i go to the frontend, it's show an error about the observer class does not exist :(\r\n\r\n### Expected result\r\n1.  No error\r\n\r\n### Actual result\r\n\r\n1 exception(s):\r\nException #0 (ReflectionException): Class Athena\\RedirectToLanguage\\Observer\\AthenaObserverRedirect does not exist\r\n\r\nException #0 (ReflectionException): Class Athena\\RedirectToLanguage\\Observer\\AthenaObserverRedirect does not exist\r\n#0 /var/www/html/athenacomputing/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Athena\\\\Redirect...')\r\n#1 /var/www/html/athenacomputing/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\\Framework\\Code\\Reader\\ClassReader->getConstructor('Athena\\\\Redirect...')\r\n#2 /var/www/html/athenacomputing/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\\Framework\\ObjectManager\\Definition\\Runtime->getParameters('Athena\\\\Redirect...')\r\n#3 /var/www/html/athenacomputing/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Athena\\\\Redirect...')\r\n#4 /var/www/html/athenacomputing/vendor/magento/framework/Event/ObserverFactory.php(33): Magento\\Framework\\ObjectManager\\ObjectManager->get('Athena\\\\Redirect...')\r\n#5 /var/www/html/athenacomputing/vendor/magento/framework/Event/Invoker/InvokerDefault.php(59): Magento\\Framework\\Event\\ObserverFactory->get('Athena\\\\Redirect...')\r\n#6 /var/www/html/athenacomputing/vendor/magento/framework/Event/Manager.php(66): Magento\\Framework\\Event\\Invoker\\InvokerDefault->dispatch(Array, Object(Magento\\Framework\\Event\\Observer))\r\n#7 /var/www/html/athenacomputing/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\\Framework\\Event\\Manager->dispatch('controller_acti...', Array)\r\n#8 /var/www/html/athenacomputing/vendor/magento/framework/App/Action/Action.php(91): Magento\\Framework\\Event\\Manager\\Proxy->dispatch('controller_acti...', Array)\r\n#9 /var/www/html/athenacomputing/vendor/magento/framework/Interception/Interceptor.php(74): Magento\\Framework\\App\\Action\\Action->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\r\n\r\n<!--- (This may be platform independent comment) -->\r\n"}}
{"actor":{"display_login":"ad1rie1"}}