difference between to get entity calls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamie
    Senior Member
    • Aug 2025
    • 155

    #1

    difference between to get entity calls

    What is the difference between

    getRDBRepository and getRepository

    the documentation doesn't explain this
  • tgr
    Junior Member
    • Jun 2025
    • 13

    #2
    Hello

    Documentation is here. ORM - EspoCRM Documentation. getRDBRepository gives you a fully-fledged repository for interacting with an entity type in a relational database (joining, having -clauses, ordering, ...) while the class returned by getRepository only has a minimum contract (getNew, getById, save, remove​).

    Comment

    • jamie
      Senior Member
      • Aug 2025
      • 155

      #3
      Originally posted by tgr
      Hello

      Documentation is here. ORM - EspoCRM Documentation. getRDBRepository gives you a fully-fledged repository for interacting with an entity type in a relational database (joining, having -clauses, ordering, ...) while the class returned by getRepository only has a minimum contract (getNew, getById, save, remove).
      ok, that's good to know, but where abouts do you see that i just see them randomly used without any explanation of what each one does

      Comment

      • tgr
        Junior Member
        • Jun 2025
        • 13

        #4
        Originally posted by jamie

        ok, that's good to know, but where abouts do you see that i just see them randomly used without any explanation of what each one does
        I think the documentation I linked to quite consistently uses the RDBRepository, which to me makes sense as that's the more capable one, with SQL filtering functions and access to an RDBSelectBuilder for creating more complex queries. That's also what I've used so far for my "exploratory coding" since starting my Espo journey a few months ago. I mainly use the official documentation, which I find good, and the Espo source on GitHub to do my things. Can't really speak for other sources, sorry.

        Comment

        • jamie
          Senior Member
          • Aug 2025
          • 155

          #5
          Originally posted by tgr

          I think the documentation I linked to quite consistently uses the RDBRepository, which to me makes sense as that's the more capable one, with SQL filtering functions and access to an RDBSelectBuilder for creating more complex queries. That's also what I've used so far for my "exploratory coding" since starting my Espo journey a few months ago. I mainly use the official documentation, which I find good, and the Espo source on GitHub to do my things. Can't really speak for other sources, sorry.
          That's the thing it never explains what the difference is, just shows some random examples, and without more knowledge, you can't build the knowledge without painful trial and error. When I see it i just see a dump of functions with little to no explanation on how to use them or what the difference is, ultimately very poor documentation you might have the time and energy to waste on "exploratory coding," but i got things to deliver as i am managing espo for a medium-sized company

          at the moment, the only way the docs are vaguely usable is with AI assistance which even then tends to get things drastically wrong

          Comment

          • tgr
            Junior Member
            • Jun 2025
            • 13

            #6
            Originally posted by jamie

            That's the thing it never explains what the difference is, just shows some random examples, and without more knowledge, you can't build the knowledge without painful trial and error. When I see it i just see a dump of functions with little to no explanation on how to use them or what the difference is, ultimately very poor documentation you might have the time and energy to waste on "exploratory coding," but i got things to deliver as i am managing espo for a medium-sized company

            at the moment, the only way the docs are vaguely usable is with AI assistance which even then tends to get things drastically wrong
            What is time wasted to one, is learning to the other... And what makes you think I don't have deliverables? You don't need to take your frustrations out on me, I was trying to help by pointing to the documentation, which I've found to be pretty helpful. By using the documentation, Espo's sources, ChatGPT and this forum, I've managed to build 3 extension with several features between them (custom dashlet, hooks, Primary Filters, an extension to the Flotr2 graph lib, a Lead Capture style public form, custom front-end modals...). I have noticed that ChatGPT tend to focus on v7/v8 of Espo, not the current 9. So that's something to be aware of.

            I don't know what kind of documentation you are looking for. For as large a platform as Espo is, I think it would be quite hard to provide a 100 % "if you need that, use this" style of documentation.




            Comment

            • jamie
              Senior Member
              • Aug 2025
              • 155

              #7
              Originally posted by tgr

              What is time wasted to one, is learning to the other... And what makes you think I don't have deliverables? You don't need to take your frustrations out on me, I was trying to help by pointing to the documentation, which I've found to be pretty helpful. By using the documentation, Espo's sources, ChatGPT and this forum, I've managed to build 3 extension with several features between them (custom dashlet, hooks, Primary Filters, an extension to the Flotr2 graph lib, a Lead Capture style public form, custom front-end modals...). I have noticed that ChatGPT tend to focus on v7/v8 of Espo, not the current 9. So that's something to be aware of.

              I don't know what kind of documentation you are looking for. For as large a platform as Espo is, I think it would be quite hard to provide a 100 % "if you need that, use this" style of documentation.



              sorry i didn't mean to direct any of it towards you, just the frustration at the poor documentation.

              For the most part, i find the documentation to be more confusing than helpful, just kind of dumped there with no explanation and as you say, you need to use 3 other sources to get work done, just proves how bad the documentation is

              i am not expecting 100% of the most minute parts of Espo, but something that is geared to actually teaching you how to start is kind of the norm with most successful projects. Look at any long-running, widely used open source project, Laravel, for example. Documentation is a key part of it, not some afterthought with the ethos that " the users will have to dig through code and annoy other users to get a basic understanding."

              This topic, for example, i can't find anywhere on the page where it explains the difference between the 2 functions, sure it shows that there are differences but what are they, why are they, when would i use one v the other??? no idea, just a bunch of examples dumped on the page with near enough no explanation

              This is not the way to grow a community. People will come here, get frustrated, and go to a worse yet better documented product. Why? because they can use it without having to go through 4 different sources to figure it out

              Sorry for the rant, i am just so frustrated with the documentation ethos here, why make this harder to use than it needs to be?

              Comment

              • yuri
                EspoCRM product developer
                • Mar 2014
                • 9513

                #8
                There's no need to keep repeating the same over on the forum. Your feedback has been heard. The documentation is not very good for you. Keep repeating the same over and over stops being a feedback and becomes a harassment.
                If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                Comment

                • tgr
                  Junior Member
                  • Jun 2025
                  • 13

                  #9
                  Originally posted by jamie

                  sorry i didn't mean to direct any of it towards you, just the frustration at the poor documentation.

                  For the most part, i find the documentation to be more confusing than helpful, just kind of dumped there with no explanation and as you say, you need to use 3 other sources to get work done, just proves how bad the documentation is

                  i am not expecting 100% of the most minute parts of Espo, but something that is geared to actually teaching you how to start is kind of the norm with most successful projects. Look at any long-running, widely used open source project, Laravel, for example. Documentation is a key part of it, not some afterthought with the ethos that " the users will have to dig through code and annoy other users to get a basic understanding."

                  This topic, for example, i can't find anywhere on the page where it explains the difference between the 2 functions, sure it shows that there are differences but what are they, why are they, when would i use one v the other??? no idea, just a bunch of examples dumped on the page with near enough no explanation

                  This is not the way to grow a community. People will come here, get frustrated, and go to a worse yet better documented product. Why? because they can use it without having to go through 4 different sources to figure it out

                  Sorry for the rant, i am just so frustrated with the documentation ethos here, why make this harder to use than it needs to be?

                  Laravel is an application framework, its sole purpose is to be used for coding, building applications. That's why it needs to be well documented from that aspect. Espo is an application in itself, with great extension possibilities. If you compare Espo's administration and user guides to its developer documentation, you are right that the latter is thinner. Still IMHO decent. I guess it's a resource issue: if 80 % of users install Espo and configure it through the UI, 80 % of the documentation efforts tend to go towards that.

                  It's around five months since I first installed Espo and I have say a month and a half of more serious, but still side-project, dev experience now. This is my take on how to get up to speed with development*
                  • Use the ext-template repo described in the documentation
                  • Understand the dependency injection system. It's really powerful
                  • Know the metadata (this is well documented)
                  • Learn the ORM
                  • Build the entity you need in the UI, look at what's generated
                  • Familiarize yourself with the source code
                  YMMV on the last one, but the source code is the definitive truth about Espo, so I thought I might as well bite the bullet early.

                  To go back your specific question on getRDBRepository vs getRepository. I'd say it depends on what you need. For just creating and saving an entity, both are good (you can also use the shortcuts getNewEntity and saveEntity on the entity manager). For querying the database, joining, where clauses, use getRDBRepository.
                  *I'm not claiming this is the wayto learn Espo or that you are going about things the wrong way. It's just my personal take and how I've got going.

                  Comment

                  • yuri
                    EspoCRM product developer
                    • Mar 2014
                    • 9513

                    #10
                    For developers, I always highly recommend to set up the IDE first, so that all type hinting is supported including the generic/templates. This is essential, without it developing will be much more difficult. For a good written library I may find myself not checking docs at all. Or there are often almost no docs. All the docs is code and the IDE makes it easier to understand.
                    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                    Comment


                    • tgr
                      tgr commented
                      Editing a comment
                      Yes, setting up the IDE with code completion is great, of course! I like that even JSON metadata has completions, thanks to the schema 🤩

                    • yuri
                      yuri commented
                      Editing a comment
                      Glad it's useful. It took me a while to define it entirely, it was worth it.
                  • yuri
                    EspoCRM product developer
                    • Mar 2014
                    • 9513

                    #11
                    To answer the original question. tgr explained it correctly. The getRepository method is kept for non-RDB storage types. It won't be ever needed for 99% developers.
                    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                    Comment

                    • jamie
                      Senior Member
                      • Aug 2025
                      • 155

                      #12
                      Originally posted by yuri
                      For developers, I always highly recommend to set up the IDE first, so that all type hinting is supported including the generic/templates. This is essential, without it developing will be much more difficult. For a good written library I may find myself not checking docs at all. Or there are often almost no docs. All the docs is code and the IDE makes it easier to understand.
                      any suggestions on how to set up VSCode? i think it does most of that automatically, though it seems to get a bit confused with some aspects of espo

                      Comment

                      • jamie
                        Senior Member
                        • Aug 2025
                        • 155

                        #13
                        Originally posted by yuri
                        To answer the original question. tgr explained it correctly. The getRepository method is kept for non-RDB storage types. It won't be ever needed for 99% developers.
                        when would i want to use getRepository? Would that just be for legacy tables?

                        is there anywhere could find some useful examples of how to use getRDBRepository?

                        it seems to be a very important part of developing for espo that i'd like to master

                        Comment

                        • jamie
                          Senior Member
                          • Aug 2025
                          • 155

                          #14
                          Originally posted by tgr


                          Laravel is an application framework, its sole purpose is to be used for coding, building applications. That's why it needs to be well documented from that aspect. Espo is an application in itself, with great extension possibilities. If you compare Espo's administration and user guides to its developer documentation, you are right that the latter is thinner. Still IMHO decent. I guess it's a resource issue: if 80 % of users install Espo and configure it through the UI, 80 % of the documentation efforts tend to go towards that.

                          It's around five months since I first installed Espo and I have say a month and a half of more serious, but still side-project, dev experience now. This is my take on how to get up to speed with development*
                          • Use the ext-template repo described in the documentation
                          • Understand the dependency injection system. It's really powerful
                          • Know the metadata (this is well documented)
                          • Learn the ORM
                          • Build the entity you need in the UI, look at what's generated
                          • Familiarize yourself with the source code
                          YMMV on the last one, but the source code is the definitive truth about Espo, so I thought I might as well bite the bullet early.

                          To go back your specific question on getRDBRepository vs getRepository. I'd say it depends on what you need. For just creating and saving an entity, both are good (you can also use the shortcuts getNewEntity and saveEntity on the entity manager). For querying the database, joining, where clauses, use getRDBRepository.
                          *I'm not claiming this is the wayto learn Espo or that you are going about things the wrong way. It's just my personal take and how I've got going.
                          what documentation were you using to build your first ext-template? i don't see it listed in the docs

                          as you are doing this for a side project, you clearly have way more time to dig through source code than i do, i just want to use and create on it without reading every line of source code

                          Comment

                          • tgr
                            Junior Member
                            • Jun 2025
                            • 13

                            #15
                            Originally posted by jamie

                            what documentation were you using to build your first ext-template? i don't see it listed in the docs

                            as you are doing this for a side project, you clearly have way more time to dig through source code than i do, i just want to use and create on it without reading every line of source code
                            Espo doc's > Developer > Getting started > Option B. Extension development. Here is the direct link: https://docs.espocrm.com/development...on-development.

                            I like how you assume I have way more time just because it's a side project. I would argue the contrary, really, with my main job, studies, and family claiming their fair share too. I've found that just wanting to use something without putting int the effort seldom works. But I'm not entering a pissing contest with you. Good luck with your future endeavors and happy Espoing!

                            Comment

                            Working...