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)

How to answer pointed "are you quitting" questioning when I don't want them to suspect

Is this food a bread or a loaf?

Does it makes sense to buy a new cycle to learn riding?

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

Monty Hall variation

Why is the maximum length of OpenWrt’s root password 8 characters?

How to create dashed lines/arrows in Illustrator

How to make payment on the internet without leaving a money trail?

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?

Access elements in std::string where positon of string is greater than its size

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

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

What does "rabbited" mean/imply in this sentence?

Is "plugging out" electronic devices an American expression?

Dual Citizen. Exited the US on Italian passport recently

Lethal sonic weapons

"Riffle" two strings

Why did Howard Stark use all the Vibranium they had on a prototype shield?

Inversion Puzzle

Which Sci-Fi work first showed weapon of galactic-scale mass destruction?

Is there a name of the flying bionic bird?

What is the meaning of Triage in Cybersec world?

Understanding the implication of what "well-defined" means for the operation in quotient group

How come people say “Would of”?



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|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























            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|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|improve this answer

























                                        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|improve this answer













                                        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|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered 11 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

                                                    Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                                                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                                                    How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2