Magento 2: Load storeview id in controller returns errorInjecting Dependencies into a Magento 2 CRUD/Abstract ModelMagento 2: Plugin class does not existMagento 2 unknown error on exception.logMagento 2 ErrorOverride __construct MagentoCatalogModelProductmagento error logs Error log record number: 1173359093956Warning: session_regenerate_id(): Session object destruction failed. on Magento 2 CheckoutMagento 2 Override ListProduct.php Block FileRuntimeException When i Load Helper Class magento 2Magento 2 Site is Inacessible

Meaning and structure of headline "Hair it is: A List of ..."

Why do so many people play out of turn on the last lead?

Unconventional examples of mathematical modelling

The Roommates' Dilemma

μονάδαι as plural form of μονάς

What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?

Why don't modern jet engines use forced exhaust mixing?

Unsolved Problems due to Lack of Computational Power

Airline power sockets shut down when I plug my computer in. How can I avoid that?

Gofer work in exchange for Letter of Recommendation

What happened after the end of the Truman Show?

Can I submit a paper computer science conference using an alias if using my real name can cause legal trouble in my original country

Does the Temple of the Gods spell nullify critical hits?

Best model for precedence constraints within scheduling problem

What is the best way to use errors in mathematica M12?

How to use the passive form to say "This flower was watered."

When does The Truman Show take place?

Did Michelle Obama have a staff of 23; and Melania have a staff of 4?

Tikz: The position of a label change step-wise and not in a continuous way

Can anybody tell me who this Pokemon is?

Why should I pay for an SSL certificate?

Why does this image of cyclocarbon look like a nonagon?

Designing a prison for a telekinetic race

The anatomy of an organic infrared generator



Magento 2: Load storeview id in controller returns error


Injecting Dependencies into a Magento 2 CRUD/Abstract ModelMagento 2: Plugin class does not existMagento 2 unknown error on exception.logMagento 2 ErrorOverride __construct MagentoCatalogModelProductmagento error logs Error log record number: 1173359093956Warning: session_regenerate_id(): Session object destruction failed. on Magento 2 CheckoutMagento 2 Override ListProduct.php Block FileRuntimeException When i Load Helper Class magento 2Magento 2 Site is Inacessible






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I loaded following class into my controller:



use MagentoStoreModelStoreManagerInterf‌​ace;


And injected it in my constructor:



StoreManagerInterf‌​ace $storeManagerInterface,


However it returns following error:



Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: QxsVerkoopjeControllerIndexIndexInterceptor


How to load the storeManager in my controller?










share|improve this question
























  • Remove generated folder please.

    – Rohan Hapani
    Aug 6 at 9:13











  • Thanks, I thought i never have to do that in developer mode... Now it returns : Exception #0 (RuntimeException): Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you

    – Coen Ponsen
    Aug 6 at 9:21












  • Try to run php bin/magento setup:upgrade and php bin/magento setup:di:compile

    – Moin Malek
    Aug 6 at 9:34











  • It keeps returning:Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: Th e requested class did not generate properly, because the 'generated' direct ory permission is read-only. If --- after running the 'bin/magento setup:di :compile' CLI command when the 'generated' directory permission is set to w rite --- the requested class did not generate properly, then you must add t he generated class object to the signature of the related construct method, only.

    – Coen Ponsen
    Aug 6 at 10:11












  • Go to this path vendor/magento/module-store/Model/StoreManagerInterface.php and check please file available or not.

    – Rohan Hapani
    Aug 6 at 10:18

















1















I loaded following class into my controller:



use MagentoStoreModelStoreManagerInterf‌​ace;


And injected it in my constructor:



StoreManagerInterf‌​ace $storeManagerInterface,


However it returns following error:



Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: QxsVerkoopjeControllerIndexIndexInterceptor


How to load the storeManager in my controller?










share|improve this question
























  • Remove generated folder please.

    – Rohan Hapani
    Aug 6 at 9:13











  • Thanks, I thought i never have to do that in developer mode... Now it returns : Exception #0 (RuntimeException): Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you

    – Coen Ponsen
    Aug 6 at 9:21












  • Try to run php bin/magento setup:upgrade and php bin/magento setup:di:compile

    – Moin Malek
    Aug 6 at 9:34











  • It keeps returning:Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: Th e requested class did not generate properly, because the 'generated' direct ory permission is read-only. If --- after running the 'bin/magento setup:di :compile' CLI command when the 'generated' directory permission is set to w rite --- the requested class did not generate properly, then you must add t he generated class object to the signature of the related construct method, only.

    – Coen Ponsen
    Aug 6 at 10:11












  • Go to this path vendor/magento/module-store/Model/StoreManagerInterface.php and check please file available or not.

    – Rohan Hapani
    Aug 6 at 10:18













1












1








1








I loaded following class into my controller:



use MagentoStoreModelStoreManagerInterf‌​ace;


And injected it in my constructor:



StoreManagerInterf‌​ace $storeManagerInterface,


However it returns following error:



Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: QxsVerkoopjeControllerIndexIndexInterceptor


How to load the storeManager in my controller?










share|improve this question














I loaded following class into my controller:



use MagentoStoreModelStoreManagerInterf‌​ace;


And injected it in my constructor:



StoreManagerInterf‌​ace $storeManagerInterface,


However it returns following error:



Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: QxsVerkoopjeControllerIndexIndexInterceptor


How to load the storeManager in my controller?







magento2 store-view






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 6 at 9:09









Coen PonsenCoen Ponsen

1511 silver badge10 bronze badges




1511 silver badge10 bronze badges















  • Remove generated folder please.

    – Rohan Hapani
    Aug 6 at 9:13











  • Thanks, I thought i never have to do that in developer mode... Now it returns : Exception #0 (RuntimeException): Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you

    – Coen Ponsen
    Aug 6 at 9:21












  • Try to run php bin/magento setup:upgrade and php bin/magento setup:di:compile

    – Moin Malek
    Aug 6 at 9:34











  • It keeps returning:Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: Th e requested class did not generate properly, because the 'generated' direct ory permission is read-only. If --- after running the 'bin/magento setup:di :compile' CLI command when the 'generated' directory permission is set to w rite --- the requested class did not generate properly, then you must add t he generated class object to the signature of the related construct method, only.

    – Coen Ponsen
    Aug 6 at 10:11












  • Go to this path vendor/magento/module-store/Model/StoreManagerInterface.php and check please file available or not.

    – Rohan Hapani
    Aug 6 at 10:18

















  • Remove generated folder please.

    – Rohan Hapani
    Aug 6 at 9:13











  • Thanks, I thought i never have to do that in developer mode... Now it returns : Exception #0 (RuntimeException): Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you

    – Coen Ponsen
    Aug 6 at 9:21












  • Try to run php bin/magento setup:upgrade and php bin/magento setup:di:compile

    – Moin Malek
    Aug 6 at 9:34











  • It keeps returning:Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: Th e requested class did not generate properly, because the 'generated' direct ory permission is read-only. If --- after running the 'bin/magento setup:di :compile' CLI command when the 'generated' directory permission is set to w rite --- the requested class did not generate properly, then you must add t he generated class object to the signature of the related construct method, only.

    – Coen Ponsen
    Aug 6 at 10:11












  • Go to this path vendor/magento/module-store/Model/StoreManagerInterface.php and check please file available or not.

    – Rohan Hapani
    Aug 6 at 10:18
















Remove generated folder please.

– Rohan Hapani
Aug 6 at 9:13





Remove generated folder please.

– Rohan Hapani
Aug 6 at 9:13













Thanks, I thought i never have to do that in developer mode... Now it returns : Exception #0 (RuntimeException): Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you

– Coen Ponsen
Aug 6 at 9:21






Thanks, I thought i never have to do that in developer mode... Now it returns : Exception #0 (RuntimeException): Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you

– Coen Ponsen
Aug 6 at 9:21














Try to run php bin/magento setup:upgrade and php bin/magento setup:di:compile

– Moin Malek
Aug 6 at 9:34





Try to run php bin/magento setup:upgrade and php bin/magento setup:di:compile

– Moin Malek
Aug 6 at 9:34













It keeps returning:Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: Th e requested class did not generate properly, because the 'generated' direct ory permission is read-only. If --- after running the 'bin/magento setup:di :compile' CLI command when the 'generated' directory permission is set to w rite --- the requested class did not generate properly, then you must add t he generated class object to the signature of the related construct method, only.

– Coen Ponsen
Aug 6 at 10:11






It keeps returning:Class MagentoStoreModelStoreManagerInterf‌​ace does not exist Class QxsVerkoopjeControllerIndexIndexInterceptor generation error: Th e requested class did not generate properly, because the 'generated' direct ory permission is read-only. If --- after running the 'bin/magento setup:di :compile' CLI command when the 'generated' directory permission is set to w rite --- the requested class did not generate properly, then you must add t he generated class object to the signature of the related construct method, only.

– Coen Ponsen
Aug 6 at 10:11














Go to this path vendor/magento/module-store/Model/StoreManagerInterface.php and check please file available or not.

– Rohan Hapani
Aug 6 at 10:18





Go to this path vendor/magento/module-store/Model/StoreManagerInterface.php and check please file available or not.

– Rohan Hapani
Aug 6 at 10:18










1 Answer
1






active

oldest

votes


















1














Try to use this below way :



protected $_storeManager; 

public function __construct(
.....
MagentoStoreModelStoreManagerInterface $storeManager,
.....
)

.....
$this->_storeManager = $storeManager;
.....


/**
* Get store identifier
*
* @return int
*/
public function getStoreId()

return $this->_storeManager->getStore()->getId();



After inject class in construct remove generated folder and clean cache.






share|improve this answer



























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284541%2fmagento-2-load-storeview-id-in-controller-returns-error%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Try to use this below way :



    protected $_storeManager; 

    public function __construct(
    .....
    MagentoStoreModelStoreManagerInterface $storeManager,
    .....
    )

    .....
    $this->_storeManager = $storeManager;
    .....


    /**
    * Get store identifier
    *
    * @return int
    */
    public function getStoreId()

    return $this->_storeManager->getStore()->getId();



    After inject class in construct remove generated folder and clean cache.






    share|improve this answer





























      1














      Try to use this below way :



      protected $_storeManager; 

      public function __construct(
      .....
      MagentoStoreModelStoreManagerInterface $storeManager,
      .....
      )

      .....
      $this->_storeManager = $storeManager;
      .....


      /**
      * Get store identifier
      *
      * @return int
      */
      public function getStoreId()

      return $this->_storeManager->getStore()->getId();



      After inject class in construct remove generated folder and clean cache.






      share|improve this answer



























        1












        1








        1







        Try to use this below way :



        protected $_storeManager; 

        public function __construct(
        .....
        MagentoStoreModelStoreManagerInterface $storeManager,
        .....
        )

        .....
        $this->_storeManager = $storeManager;
        .....


        /**
        * Get store identifier
        *
        * @return int
        */
        public function getStoreId()

        return $this->_storeManager->getStore()->getId();



        After inject class in construct remove generated folder and clean cache.






        share|improve this answer













        Try to use this below way :



        protected $_storeManager; 

        public function __construct(
        .....
        MagentoStoreModelStoreManagerInterface $storeManager,
        .....
        )

        .....
        $this->_storeManager = $storeManager;
        .....


        /**
        * Get store identifier
        *
        * @return int
        */
        public function getStoreId()

        return $this->_storeManager->getStore()->getId();



        After inject class in construct remove generated folder and clean cache.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 6 at 9:24









        Rohan HapaniRohan Hapani

        8,7684 gold badges21 silver badges66 bronze badges




        8,7684 gold badges21 silver badges66 bronze badges






























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284541%2fmagento-2-load-storeview-id-in-controller-returns-error%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?