Magento 2 Class *Factory does not exist The 2019 Stack Overflow Developer Survey Results Are InCustom module factory not working (method is undefined)Error: Class PbuploadMediaGridDataProvider does not existClass MagentoCatalogInventoryModelStockRegistryStorage does not existMagento 2 - while saving product from admin getting error as Class MagentoConfigurableProductModelProductVariationHandler does not existgetting error: Class MagentoIndexerModelResourceModelIndexerStateCollectionFactory does not existOrder saving error: Class NamespaceModuleObserverOrderCancelled does not existException after bin/magento setup:di:compile and adding virtualTypeGeneration does not existMagento 2 Error: Class does not existHow to fix: Class from deleted module does not exist (Magento 2.3)

Should I write numbers in words or as numerals when there are multiple next to each other?

How can I fix this gap between bookcases I made?

Where to refill my bottle in India?

The difference between dialogue marks

I looked up a future colleague on LinkedIn before I started a job. I told my colleague about it and he seemed surprised. Should I apologize?

Is it possible for the two major parties in the UK to form a coalition with each other instead of a much smaller party?

Inflated grade on resume at previous job, might former employer tell new employer?

In microwave frequencies, do you use a circulator when you need a (near) perfect diode?

Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?

Pristine Bit Checking

Why could you hear an Amstrad CPC working?

Why is it "Tumoren" and not "Tumore"?

How was Skylab's orbit inclination chosen?

How to create dashed lines/arrows in Illustrator

How can I create a character who can assume the widest possible range of creature sizes?

How come people say “Would of”?

Could JWST stay at L2 "forever"?

On the insanity of kings as an argument against monarchy

Springs with some finite mass

"To split hairs" vs "To be pedantic"

It's possible to achieve negative score?

Does duplicating a spell with Wish count as casting that spell?

Why do UK politicians seemingly ignore opinion polls on Brexit?

What effect does the “loading” weapon property have in practical terms?



Magento 2 Class *Factory does not exist



The 2019 Stack Overflow Developer Survey Results Are InCustom module factory not working (method is undefined)Error: Class PbuploadMediaGridDataProvider does not existClass MagentoCatalogInventoryModelStockRegistryStorage does not existMagento 2 - while saving product from admin getting error as Class MagentoConfigurableProductModelProductVariationHandler does not existgetting error: Class MagentoIndexerModelResourceModelIndexerStateCollectionFactory does not existOrder saving error: Class NamespaceModuleObserverOrderCancelled does not existException after bin/magento setup:di:compile and adding virtualTypeGeneration does not existMagento 2 Error: Class does not existHow to fix: Class from deleted module does not exist (Magento 2.3)



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








12















I was trying to install a plugin and I removed var/generation and var/cache/*. I've checked the MAGE_MODE and I'm in developer but now when I access the front-end and the admin I get random errors saying mean things like:
Class MagentoCustomerModelCustomerFactory does not exist



Class MagentoSalesModelResourceModelReportOrderFactory does not exist



Some of the classes are being created, but not all. I've tried clearing cache again, and the generation folder but then I just get the same errors.



Any ideas?










share|improve this question



















  • 1





    check the rights on the var/generation folder

    – Marius
    Feb 24 '16 at 16:08











  • it says drwxrwxrw- 5

    – jstrez77
    Feb 24 '16 at 16:16











  • I had to clean the var/generation folder a few times, go to the home page first, the clean, then admin, then login, then clean... and it worked...?? I don't understand this

    – jstrez77
    Feb 24 '16 at 17:00

















12















I was trying to install a plugin and I removed var/generation and var/cache/*. I've checked the MAGE_MODE and I'm in developer but now when I access the front-end and the admin I get random errors saying mean things like:
Class MagentoCustomerModelCustomerFactory does not exist



Class MagentoSalesModelResourceModelReportOrderFactory does not exist



Some of the classes are being created, but not all. I've tried clearing cache again, and the generation folder but then I just get the same errors.



Any ideas?










share|improve this question



















  • 1





    check the rights on the var/generation folder

    – Marius
    Feb 24 '16 at 16:08











  • it says drwxrwxrw- 5

    – jstrez77
    Feb 24 '16 at 16:16











  • I had to clean the var/generation folder a few times, go to the home page first, the clean, then admin, then login, then clean... and it worked...?? I don't understand this

    – jstrez77
    Feb 24 '16 at 17:00













12












12








12


3






I was trying to install a plugin and I removed var/generation and var/cache/*. I've checked the MAGE_MODE and I'm in developer but now when I access the front-end and the admin I get random errors saying mean things like:
Class MagentoCustomerModelCustomerFactory does not exist



Class MagentoSalesModelResourceModelReportOrderFactory does not exist



Some of the classes are being created, but not all. I've tried clearing cache again, and the generation folder but then I just get the same errors.



Any ideas?










share|improve this question
















I was trying to install a plugin and I removed var/generation and var/cache/*. I've checked the MAGE_MODE and I'm in developer but now when I access the front-end and the admin I get random errors saying mean things like:
Class MagentoCustomerModelCustomerFactory does not exist



Class MagentoSalesModelResourceModelReportOrderFactory does not exist



Some of the classes are being created, but not all. I've tried clearing cache again, and the generation folder but then I just get the same errors.



Any ideas?







magento2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 24 '16 at 16:20









Amit Bera

59.8k1676178




59.8k1676178










asked Feb 24 '16 at 16:07









jstrez77jstrez77

3901721




3901721







  • 1





    check the rights on the var/generation folder

    – Marius
    Feb 24 '16 at 16:08











  • it says drwxrwxrw- 5

    – jstrez77
    Feb 24 '16 at 16:16











  • I had to clean the var/generation folder a few times, go to the home page first, the clean, then admin, then login, then clean... and it worked...?? I don't understand this

    – jstrez77
    Feb 24 '16 at 17:00












  • 1





    check the rights on the var/generation folder

    – Marius
    Feb 24 '16 at 16:08











  • it says drwxrwxrw- 5

    – jstrez77
    Feb 24 '16 at 16:16











  • I had to clean the var/generation folder a few times, go to the home page first, the clean, then admin, then login, then clean... and it worked...?? I don't understand this

    – jstrez77
    Feb 24 '16 at 17:00







1




1





check the rights on the var/generation folder

– Marius
Feb 24 '16 at 16:08





check the rights on the var/generation folder

– Marius
Feb 24 '16 at 16:08













it says drwxrwxrw- 5

– jstrez77
Feb 24 '16 at 16:16





it says drwxrwxrw- 5

– jstrez77
Feb 24 '16 at 16:16













I had to clean the var/generation folder a few times, go to the home page first, the clean, then admin, then login, then clean... and it worked...?? I don't understand this

– jstrez77
Feb 24 '16 at 17:00





I had to clean the var/generation folder a few times, go to the home page first, the clean, then admin, then login, then clean... and it worked...?? I don't understand this

– jstrez77
Feb 24 '16 at 17:00










8 Answers
8






active

oldest

votes


















18














Magento 2 generates Factory classes inside var/generation directory. So, if there is folder permission issue or folder owner issue with that directory then the factory class cannot be generated and you get such error.



When you clear var/generation directory and set appropriate permission to it then this error should be solved.



See more on Code generation in Magento 2






share|improve this answer























  • Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

    – Yvan
    Sep 28 '18 at 10:44


















8














For me, i removed var/generation folder then i ran magento setup:di:compile which generated all necessary classes.



(in my case : Then i was encountered with cache issue, i removed initial cache folder.)



Then it solved my issue. Cheers !!






share|improve this answer


















  • 1





    needed to change files owner at the end

    – moshe beeri
    Oct 9 '16 at 20:45



















1














In magento new versions like 2.2.2 and above this code generation path changed to



<Magento root folder>/generated


so you need to check permissions for this folder as well. You need to run following command at the root of Magento installation directory will resolve this issue:



sudo chmod -R 777 generated/





share|improve this answer

























  • clear cache as well in start

    – Hassan Ali Shahzad
    Sep 3 '18 at 8:13











  • its work for me

    – matinict
    Sep 24 '18 at 6:33


















0














Definitely permissions within 'var/generation' folder.






share|improve this answer






























    0














    It's just var folder permission issue. in CLI mode follow the following command



    sudo chmod -R 777 var/






    share|improve this answer






























      0














      Magento 2 creates the factory classes in the var/generation folder and if you add a new parameter in your __construct() and it's Factory class does not exists then Magento 2 throws the above error message. Even though there are few solutions give already for you question, i can suggest you another solution which does not require you to clear your generation folder. Please use the below command after any change is made related to Factory classes:



      bin/magento setup:di:compile


      This command can be more useful on production server.






      share|improve this answer






























        0














        The following commands are needed to be executed:



        sudo php -f bin/magento setup:di:compile 

        sudo rm -rf pub/static/*/*; sudo rm -rf var/*/*;
        sudo php -f bin/magento setup:static-content:deploy -f

        sudo php bin/magento cache:clean


        Also, proper permission is needed. If on production, you need to execute proper permissions. But, on local machine, you can run full permission:



        sudo chmod -R 777 *




        share






























          -2














          Class ...Factory does not exist means your model class not loaded.
          As Magento 2 based on modular programming so we need to specify the model class where we want to use explicitly.
          We can use our model class in two types:



          1.by "use"



          use MagentoCustomerSetupCustomerSetupFactory;

          public function __construct(CustomerSetupFactory $customerSetupFactory)

          $this->customerSetupFactory = $customerSetupFactory;




          1. Directly



            public function __construct(MagentoCustomerSetupCustomerSetupFactory $customerSetupFactory)

            $this->customerSetupFactory = $customerSetupFactory;




          When you hit the URL(http://domain.com/your module frontname) of your plugin on browser than the Magento generate the code for your module as below:



          vargenerationYour Vendor DirectoryYour Module DirectoryController
          vargenerationYour Vendor DirectoryYour Module DirectoryModel


          In your case you need to check the "CustomerFactory" and "OrderFactory" is used as above format or not.






          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%2f103312%2fmagento-2-class-factory-does-not-exist%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            8 Answers
            8






            active

            oldest

            votes








            8 Answers
            8






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            18














            Magento 2 generates Factory classes inside var/generation directory. So, if there is folder permission issue or folder owner issue with that directory then the factory class cannot be generated and you get such error.



            When you clear var/generation directory and set appropriate permission to it then this error should be solved.



            See more on Code generation in Magento 2






            share|improve this answer























            • Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

              – Yvan
              Sep 28 '18 at 10:44















            18














            Magento 2 generates Factory classes inside var/generation directory. So, if there is folder permission issue or folder owner issue with that directory then the factory class cannot be generated and you get such error.



            When you clear var/generation directory and set appropriate permission to it then this error should be solved.



            See more on Code generation in Magento 2






            share|improve this answer























            • Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

              – Yvan
              Sep 28 '18 at 10:44













            18












            18








            18







            Magento 2 generates Factory classes inside var/generation directory. So, if there is folder permission issue or folder owner issue with that directory then the factory class cannot be generated and you get such error.



            When you clear var/generation directory and set appropriate permission to it then this error should be solved.



            See more on Code generation in Magento 2






            share|improve this answer













            Magento 2 generates Factory classes inside var/generation directory. So, if there is folder permission issue or folder owner issue with that directory then the factory class cannot be generated and you get such error.



            When you clear var/generation directory and set appropriate permission to it then this error should be solved.



            See more on Code generation in Magento 2







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 24 '16 at 18:20









            Mukesh ChapagainMukesh Chapagain

            3,88612343




            3,88612343












            • Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

              – Yvan
              Sep 28 '18 at 10:44

















            • Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

              – Yvan
              Sep 28 '18 at 10:44
















            Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

            – Yvan
            Sep 28 '18 at 10:44





            Could be also var/di or var/cache, see devdocs.magento.com/guides/v2.2/install-gde/trouble/…

            – Yvan
            Sep 28 '18 at 10:44













            8














            For me, i removed var/generation folder then i ran magento setup:di:compile which generated all necessary classes.



            (in my case : Then i was encountered with cache issue, i removed initial cache folder.)



            Then it solved my issue. Cheers !!






            share|improve this answer


















            • 1





              needed to change files owner at the end

              – moshe beeri
              Oct 9 '16 at 20:45
















            8














            For me, i removed var/generation folder then i ran magento setup:di:compile which generated all necessary classes.



            (in my case : Then i was encountered with cache issue, i removed initial cache folder.)



            Then it solved my issue. Cheers !!






            share|improve this answer


















            • 1





              needed to change files owner at the end

              – moshe beeri
              Oct 9 '16 at 20:45














            8












            8








            8







            For me, i removed var/generation folder then i ran magento setup:di:compile which generated all necessary classes.



            (in my case : Then i was encountered with cache issue, i removed initial cache folder.)



            Then it solved my issue. Cheers !!






            share|improve this answer













            For me, i removed var/generation folder then i ran magento setup:di:compile which generated all necessary classes.



            (in my case : Then i was encountered with cache issue, i removed initial cache folder.)



            Then it solved my issue. Cheers !!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 20 '16 at 9:03









            Suman K.CSuman K.C

            789627




            789627







            • 1





              needed to change files owner at the end

              – moshe beeri
              Oct 9 '16 at 20:45













            • 1





              needed to change files owner at the end

              – moshe beeri
              Oct 9 '16 at 20:45








            1




            1





            needed to change files owner at the end

            – moshe beeri
            Oct 9 '16 at 20:45






            needed to change files owner at the end

            – moshe beeri
            Oct 9 '16 at 20:45












            1














            In magento new versions like 2.2.2 and above this code generation path changed to



            <Magento root folder>/generated


            so you need to check permissions for this folder as well. You need to run following command at the root of Magento installation directory will resolve this issue:



            sudo chmod -R 777 generated/





            share|improve this answer

























            • clear cache as well in start

              – Hassan Ali Shahzad
              Sep 3 '18 at 8:13











            • its work for me

              – matinict
              Sep 24 '18 at 6:33















            1














            In magento new versions like 2.2.2 and above this code generation path changed to



            <Magento root folder>/generated


            so you need to check permissions for this folder as well. You need to run following command at the root of Magento installation directory will resolve this issue:



            sudo chmod -R 777 generated/





            share|improve this answer

























            • clear cache as well in start

              – Hassan Ali Shahzad
              Sep 3 '18 at 8:13











            • its work for me

              – matinict
              Sep 24 '18 at 6:33













            1












            1








            1







            In magento new versions like 2.2.2 and above this code generation path changed to



            <Magento root folder>/generated


            so you need to check permissions for this folder as well. You need to run following command at the root of Magento installation directory will resolve this issue:



            sudo chmod -R 777 generated/





            share|improve this answer















            In magento new versions like 2.2.2 and above this code generation path changed to



            <Magento root folder>/generated


            so you need to check permissions for this folder as well. You need to run following command at the root of Magento installation directory will resolve this issue:



            sudo chmod -R 777 generated/






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Sep 27 '18 at 13:02









            Nadeem0035

            593411




            593411










            answered Sep 3 '18 at 8:11









            Hassan Ali ShahzadHassan Ali Shahzad

            734317




            734317












            • clear cache as well in start

              – Hassan Ali Shahzad
              Sep 3 '18 at 8:13











            • its work for me

              – matinict
              Sep 24 '18 at 6:33

















            • clear cache as well in start

              – Hassan Ali Shahzad
              Sep 3 '18 at 8:13











            • its work for me

              – matinict
              Sep 24 '18 at 6:33
















            clear cache as well in start

            – Hassan Ali Shahzad
            Sep 3 '18 at 8:13





            clear cache as well in start

            – Hassan Ali Shahzad
            Sep 3 '18 at 8:13













            its work for me

            – matinict
            Sep 24 '18 at 6:33





            its work for me

            – matinict
            Sep 24 '18 at 6:33











            0














            Definitely permissions within 'var/generation' folder.






            share|improve this answer



























              0














              Definitely permissions within 'var/generation' folder.






              share|improve this answer

























                0












                0








                0







                Definitely permissions within 'var/generation' folder.






                share|improve this answer













                Definitely permissions within 'var/generation' folder.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 20 '17 at 15:33









                Travis van der FontTravis van der Font

                1012




                1012





















                    0














                    It's just var folder permission issue. in CLI mode follow the following command



                    sudo chmod -R 777 var/






                    share|improve this answer



























                      0














                      It's just var folder permission issue. in CLI mode follow the following command



                      sudo chmod -R 777 var/






                      share|improve this answer

























                        0












                        0








                        0







                        It's just var folder permission issue. in CLI mode follow the following command



                        sudo chmod -R 777 var/






                        share|improve this answer













                        It's just var folder permission issue. in CLI mode follow the following command



                        sudo chmod -R 777 var/







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Mar 19 '18 at 3:41









                        AnwarAnwar

                        3910




                        3910





















                            0














                            Magento 2 creates the factory classes in the var/generation folder and if you add a new parameter in your __construct() and it's Factory class does not exists then Magento 2 throws the above error message. Even though there are few solutions give already for you question, i can suggest you another solution which does not require you to clear your generation folder. Please use the below command after any change is made related to Factory classes:



                            bin/magento setup:di:compile


                            This command can be more useful on production server.






                            share|improve this answer



























                              0














                              Magento 2 creates the factory classes in the var/generation folder and if you add a new parameter in your __construct() and it's Factory class does not exists then Magento 2 throws the above error message. Even though there are few solutions give already for you question, i can suggest you another solution which does not require you to clear your generation folder. Please use the below command after any change is made related to Factory classes:



                              bin/magento setup:di:compile


                              This command can be more useful on production server.






                              share|improve this answer

























                                0












                                0








                                0







                                Magento 2 creates the factory classes in the var/generation folder and if you add a new parameter in your __construct() and it's Factory class does not exists then Magento 2 throws the above error message. Even though there are few solutions give already for you question, i can suggest you another solution which does not require you to clear your generation folder. Please use the below command after any change is made related to Factory classes:



                                bin/magento setup:di:compile


                                This command can be more useful on production server.






                                share|improve this answer













                                Magento 2 creates the factory classes in the var/generation folder and if you add a new parameter in your __construct() and it's Factory class does not exists then Magento 2 throws the above error message. Even though there are few solutions give already for you question, i can suggest you another solution which does not require you to clear your generation folder. Please use the below command after any change is made related to Factory classes:



                                bin/magento setup:di:compile


                                This command can be more useful on production server.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 27 '18 at 13:12









                                Sourabh Kumar SharmaSourabh Kumar Sharma

                                671316




                                671316





















                                    0














                                    The following commands are needed to be executed:



                                    sudo php -f bin/magento setup:di:compile 

                                    sudo rm -rf pub/static/*/*; sudo rm -rf var/*/*;
                                    sudo php -f bin/magento setup:static-content:deploy -f

                                    sudo php bin/magento cache:clean


                                    Also, proper permission is needed. If on production, you need to execute proper permissions. But, on local machine, you can run full permission:



                                    sudo chmod -R 777 *




                                    share



























                                      0














                                      The following commands are needed to be executed:



                                      sudo php -f bin/magento setup:di:compile 

                                      sudo rm -rf pub/static/*/*; sudo rm -rf var/*/*;
                                      sudo php -f bin/magento setup:static-content:deploy -f

                                      sudo php bin/magento cache:clean


                                      Also, proper permission is needed. If on production, you need to execute proper permissions. But, on local machine, you can run full permission:



                                      sudo chmod -R 777 *




                                      share

























                                        0












                                        0








                                        0







                                        The following commands are needed to be executed:



                                        sudo php -f bin/magento setup:di:compile 

                                        sudo rm -rf pub/static/*/*; sudo rm -rf var/*/*;
                                        sudo php -f bin/magento setup:static-content:deploy -f

                                        sudo php bin/magento cache:clean


                                        Also, proper permission is needed. If on production, you need to execute proper permissions. But, on local machine, you can run full permission:



                                        sudo chmod -R 777 *




                                        share













                                        The following commands are needed to be executed:



                                        sudo php -f bin/magento setup:di:compile 

                                        sudo rm -rf pub/static/*/*; sudo rm -rf var/*/*;
                                        sudo php -f bin/magento setup:static-content:deploy -f

                                        sudo php bin/magento cache:clean


                                        Also, proper permission is needed. If on production, you need to execute proper permissions. But, on local machine, you can run full permission:



                                        sudo chmod -R 777 *





                                        share











                                        share


                                        share










                                        answered 3 mins ago









                                        AgiloxAgilox

                                        1306




                                        1306





















                                            -2














                                            Class ...Factory does not exist means your model class not loaded.
                                            As Magento 2 based on modular programming so we need to specify the model class where we want to use explicitly.
                                            We can use our model class in two types:



                                            1.by "use"



                                            use MagentoCustomerSetupCustomerSetupFactory;

                                            public function __construct(CustomerSetupFactory $customerSetupFactory)

                                            $this->customerSetupFactory = $customerSetupFactory;




                                            1. Directly



                                              public function __construct(MagentoCustomerSetupCustomerSetupFactory $customerSetupFactory)

                                              $this->customerSetupFactory = $customerSetupFactory;




                                            When you hit the URL(http://domain.com/your module frontname) of your plugin on browser than the Magento generate the code for your module as below:



                                            vargenerationYour Vendor DirectoryYour Module DirectoryController
                                            vargenerationYour Vendor DirectoryYour Module DirectoryModel


                                            In your case you need to check the "CustomerFactory" and "OrderFactory" is used as above format or not.






                                            share|improve this answer



























                                              -2














                                              Class ...Factory does not exist means your model class not loaded.
                                              As Magento 2 based on modular programming so we need to specify the model class where we want to use explicitly.
                                              We can use our model class in two types:



                                              1.by "use"



                                              use MagentoCustomerSetupCustomerSetupFactory;

                                              public function __construct(CustomerSetupFactory $customerSetupFactory)

                                              $this->customerSetupFactory = $customerSetupFactory;




                                              1. Directly



                                                public function __construct(MagentoCustomerSetupCustomerSetupFactory $customerSetupFactory)

                                                $this->customerSetupFactory = $customerSetupFactory;




                                              When you hit the URL(http://domain.com/your module frontname) of your plugin on browser than the Magento generate the code for your module as below:



                                              vargenerationYour Vendor DirectoryYour Module DirectoryController
                                              vargenerationYour Vendor DirectoryYour Module DirectoryModel


                                              In your case you need to check the "CustomerFactory" and "OrderFactory" is used as above format or not.






                                              share|improve this answer

























                                                -2












                                                -2








                                                -2







                                                Class ...Factory does not exist means your model class not loaded.
                                                As Magento 2 based on modular programming so we need to specify the model class where we want to use explicitly.
                                                We can use our model class in two types:



                                                1.by "use"



                                                use MagentoCustomerSetupCustomerSetupFactory;

                                                public function __construct(CustomerSetupFactory $customerSetupFactory)

                                                $this->customerSetupFactory = $customerSetupFactory;




                                                1. Directly



                                                  public function __construct(MagentoCustomerSetupCustomerSetupFactory $customerSetupFactory)

                                                  $this->customerSetupFactory = $customerSetupFactory;




                                                When you hit the URL(http://domain.com/your module frontname) of your plugin on browser than the Magento generate the code for your module as below:



                                                vargenerationYour Vendor DirectoryYour Module DirectoryController
                                                vargenerationYour Vendor DirectoryYour Module DirectoryModel


                                                In your case you need to check the "CustomerFactory" and "OrderFactory" is used as above format or not.






                                                share|improve this answer













                                                Class ...Factory does not exist means your model class not loaded.
                                                As Magento 2 based on modular programming so we need to specify the model class where we want to use explicitly.
                                                We can use our model class in two types:



                                                1.by "use"



                                                use MagentoCustomerSetupCustomerSetupFactory;

                                                public function __construct(CustomerSetupFactory $customerSetupFactory)

                                                $this->customerSetupFactory = $customerSetupFactory;




                                                1. Directly



                                                  public function __construct(MagentoCustomerSetupCustomerSetupFactory $customerSetupFactory)

                                                  $this->customerSetupFactory = $customerSetupFactory;




                                                When you hit the URL(http://domain.com/your module frontname) of your plugin on browser than the Magento generate the code for your module as below:



                                                vargenerationYour Vendor DirectoryYour Module DirectoryController
                                                vargenerationYour Vendor DirectoryYour Module DirectoryModel


                                                In your case you need to check the "CustomerFactory" and "OrderFactory" is used as above format or not.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jul 14 '16 at 6:18









                                                Suman SinghSuman Singh

                                                604614




                                                604614



























                                                    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%2f103312%2fmagento-2-class-factory-does-not-exist%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

                                                    Nidaros erkebispedøme

                                                    Birsay

                                                    Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?