magento 2 : model in custom module

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





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







up vote
1
down vote

favorite













i already have a table in database also created model files and all works fine so now added another table successfully so what changes i need to do with model files




i mean in model resourcemodel and connection files..









share







New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Have you got solution? or you have any concern.
    – Chirag Patel
    3 mins ago
















up vote
1
down vote

favorite













i already have a table in database also created model files and all works fine so now added another table successfully so what changes i need to do with model files




i mean in model resourcemodel and connection files..









share







New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Have you got solution? or you have any concern.
    – Chirag Patel
    3 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite












i already have a table in database also created model files and all works fine so now added another table successfully so what changes i need to do with model files




i mean in model resourcemodel and connection files..









share







New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












i already have a table in database also created model files and all works fine so now added another table successfully so what changes i need to do with model files




i mean in model resourcemodel and connection files..







magento2





share







New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share







New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share



share






New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 30 mins ago









Tirth Patel

706




706




New contributor




Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Tirth Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Have you got solution? or you have any concern.
    – Chirag Patel
    3 mins ago
















  • Have you got solution? or you have any concern.
    – Chirag Patel
    3 mins ago















Have you got solution? or you have any concern.
– Chirag Patel
3 mins ago




Have you got solution? or you have any concern.
– Chirag Patel
3 mins ago










3 Answers
3






active

oldest

votes

















up vote
0
down vote



accepted










@Tirth Patel
I think you should create separate model as well as Resource file for another db table.






share|improve this answer




















  • it works thanks @sagar
    – Tirth Patel
    8 mins ago


















up vote
4
down vote













You need to add another resource modal connection (CRUD)



Step : 1 Create Model




app/code/NameSpace/ModuleName/Model/Post.php




Step : 2 Create Resource Model




app/code/NameSpace/ModuleName/Model/ResourceModel/Post.php




Step : 3 Create Resource Model Collection - Get Model Collection




app/code/NameSpace/ModuleName/Model/ResourceModel/Post/Collection.php




After this please run this command line:




php bin/magento setup:upgrade



php bin/magento C:F







share|improve this answer



























    up vote
    1
    down vote













    do same process for your second table what you have done for your first table. i mean create diffrent model,resource file for your second table.






    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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      Tirth Patel is a new contributor. Be nice, and check out our Code of Conduct.









       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244542%2fmagento-2-model-in-custom-module%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote



      accepted










      @Tirth Patel
      I think you should create separate model as well as Resource file for another db table.






      share|improve this answer




















      • it works thanks @sagar
        – Tirth Patel
        8 mins ago















      up vote
      0
      down vote



      accepted










      @Tirth Patel
      I think you should create separate model as well as Resource file for another db table.






      share|improve this answer




















      • it works thanks @sagar
        – Tirth Patel
        8 mins ago













      up vote
      0
      down vote



      accepted







      up vote
      0
      down vote



      accepted






      @Tirth Patel
      I think you should create separate model as well as Resource file for another db table.






      share|improve this answer












      @Tirth Patel
      I think you should create separate model as well as Resource file for another db table.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered 28 mins ago









      sagar nakrani

      496




      496











      • it works thanks @sagar
        – Tirth Patel
        8 mins ago

















      • it works thanks @sagar
        – Tirth Patel
        8 mins ago
















      it works thanks @sagar
      – Tirth Patel
      8 mins ago





      it works thanks @sagar
      – Tirth Patel
      8 mins ago













      up vote
      4
      down vote













      You need to add another resource modal connection (CRUD)



      Step : 1 Create Model




      app/code/NameSpace/ModuleName/Model/Post.php




      Step : 2 Create Resource Model




      app/code/NameSpace/ModuleName/Model/ResourceModel/Post.php




      Step : 3 Create Resource Model Collection - Get Model Collection




      app/code/NameSpace/ModuleName/Model/ResourceModel/Post/Collection.php




      After this please run this command line:




      php bin/magento setup:upgrade



      php bin/magento C:F







      share|improve this answer
























        up vote
        4
        down vote













        You need to add another resource modal connection (CRUD)



        Step : 1 Create Model




        app/code/NameSpace/ModuleName/Model/Post.php




        Step : 2 Create Resource Model




        app/code/NameSpace/ModuleName/Model/ResourceModel/Post.php




        Step : 3 Create Resource Model Collection - Get Model Collection




        app/code/NameSpace/ModuleName/Model/ResourceModel/Post/Collection.php




        After this please run this command line:




        php bin/magento setup:upgrade



        php bin/magento C:F







        share|improve this answer






















          up vote
          4
          down vote










          up vote
          4
          down vote









          You need to add another resource modal connection (CRUD)



          Step : 1 Create Model




          app/code/NameSpace/ModuleName/Model/Post.php




          Step : 2 Create Resource Model




          app/code/NameSpace/ModuleName/Model/ResourceModel/Post.php




          Step : 3 Create Resource Model Collection - Get Model Collection




          app/code/NameSpace/ModuleName/Model/ResourceModel/Post/Collection.php




          After this please run this command line:




          php bin/magento setup:upgrade



          php bin/magento C:F







          share|improve this answer












          You need to add another resource modal connection (CRUD)



          Step : 1 Create Model




          app/code/NameSpace/ModuleName/Model/Post.php




          Step : 2 Create Resource Model




          app/code/NameSpace/ModuleName/Model/ResourceModel/Post.php




          Step : 3 Create Resource Model Collection - Get Model Collection




          app/code/NameSpace/ModuleName/Model/ResourceModel/Post/Collection.php




          After this please run this command line:




          php bin/magento setup:upgrade



          php bin/magento C:F








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 18 mins ago









          Chirag Patel

          1,466119




          1,466119




















              up vote
              1
              down vote













              do same process for your second table what you have done for your first table. i mean create diffrent model,resource file for your second table.






              share|improve this answer
























                up vote
                1
                down vote













                do same process for your second table what you have done for your first table. i mean create diffrent model,resource file for your second table.






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  do same process for your second table what you have done for your first table. i mean create diffrent model,resource file for your second table.






                  share|improve this answer












                  do same process for your second table what you have done for your first table. i mean create diffrent model,resource file for your second table.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 14 mins ago









                  balwant

                  546




                  546




















                      Tirth Patel is a new contributor. Be nice, and check out our Code of Conduct.









                       

                      draft saved


                      draft discarded


















                      Tirth Patel is a new contributor. Be nice, and check out our Code of Conduct.












                      Tirth Patel is a new contributor. Be nice, and check out our Code of Conduct.











                      Tirth Patel is a new contributor. Be nice, and check out our Code of Conduct.













                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f244542%2fmagento-2-model-in-custom-module%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What does second last employer means? [closed]

                      List of Gilmore Girls characters

                      Confectionery