Getting started as a developer in EspoCRM...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MaxDau
    Member
    • Nov 2022
    • 38

    Getting started as a developer in EspoCRM...

    As a beginner in development with EspoCRM, it's really not easy. I still spend most of my time (even after more than a week) trying to find the right classes.
    The examples from the forum are outdated and the examples from the documentation are so basic that they (mostly, if they are not also outdated) just work.

    As an example hooks:
    If I want to get to the EntityManager in a hook, I can find two examples here in the forum from users with over 1k posts.
    $this->entityManager;
    and
    $this->getEntityManager();

    If I apply the code that has been posted here on the forum for the last 2 years, none of it works. Also, how can the code work if I don't load the entityManager anywhere in my class...?

    So I keep searching and at some point I find \Espo\Core\Hooks\Base.
    When I open the class, my editor jumps out at me and calls "deprecated".
    So the searcher continues...

    Yes, I can make up a workaround. I go into the entity class that the hook should process and create a function getEntityManager(). But that can't be the solution. Unfortunately, this is how it goes with every area I want to program in EspoCRM.
    I can't remember the last time I had such problems getting through a source code when there was a forum and documentation for it. It really demotivates enormously when you invest so much time and you are so unproductive.

    If EspoCRM wasn't the best I know in terms of functions, I would probably have given up already. But EspoCRM is really a small masterpiece. Which is more than I can say about the documentation.​
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,
    there are one think you must know, many old post in forum is out-of-date (but work maybe), before espoCRM v6 .. with >= v6 many changement.

    look for sample :
    https://github.com/espocrm/espocrm/t...ules/Crm/Hooks

    is better you search for "words" in github.. you will find many sample. i have not a big skill but i find 95% solution.
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      First you need to setup your IDE (I recommend PhpStorm). With the IDE it will be much easier.

      Then read the documentation about dependency injection https://docs.espocrm.com/development/di/. And wiki article https://en.wikipedia.org/wiki/Dependency_injection.

      Once you understand the concept it will answer your question regarding hooks and entity manager. Actually, almost everything needed for starting is documented.

      TLTR: Define an entity manager as a parameter of the constructor of your hook, the framework will provide it automatically.

      > I can't remember the last time I had such problems getting through a source code when there was a forum and documentation for it. It really demotivates enormously when you invest so much time and you are so unproductive.

      I want to ask to abstain from writing such statements. You need to know some basic concepts and modern practices of programming first. You wouldn't then stumbled on such a trivial thing like injecting the entity-manager to your hook.
      Last edited by yuri; 12-17-2022, 06:31 PM.
      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

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        The Dependency Injection framework provides needed dependencies to classes (usually via a constructor).

        For example, your controller has a dependency on some service class. That service class has other dependencies (e.g. the entity manager, some utility classes), these dependencies can have their own dependencies and so on. You don't need to instantiate dependencies, you just define them in class constructors and the framework provides them automatically.

        Code:
        - MyController
            - MyService
                - EntityManager (container service)
                - MyUtilityClass1
                    - EntityManager (container service)
                    - FileStorageManager (container service)
                - MyUtilityClass2​

        This concept has been used ubiquitously in the last decade or more. I recommend reading articles on this topic on the internet.
        Last edited by yuri; 12-17-2022, 10:43 AM.
        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

        • item
          Active Community Member
          • Mar 2017
          • 1476

          #5
          Just for information :

          This IA can help incredible..

          the response is correct for me

          I will ask DI
          If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

          Comment


          • esforim
            esforim commented
            Editing a comment
            item lol , it "AI" not "IA".

            Finally realize what you mean when I see screenshot. Item recommend you asking the "AI" about coding, it can help.

            Artificial Intelligent.

          • telecastg
            telecastg commented
            Editing a comment
            Thanks for this great contribution item you are absolutely correct, this AI chat can save us many hours of "code hunting" for poorly explained or undocumented features.

            It looks like it extracts code from GuiHub similar to the GitHub Copilot.

            By the way esforim "IA" is correct in French (Intelligence Artificielle) but in English is "AI" Articicial Intelligence

          • item
            item commented
            Editing a comment
            Really, you must try : chatGPT
            It’s free.
            With your English, the AI can best respond.

            I have try with Cisco catalyst switch.. incredible.

            You can learn, it’s sure
            I learn too here : https://phptherightway.com/
            Last edited by item; 12-20-2022, 11:45 AM. Reason: https://phptherightway.com/
        • yuri
          Member
          • Mar 2014
          • 8440

          #6
          Any updates? Such posts annoys me. Someone who read it may make conclusions that the system is designed badly. But in reality all the text could just be replaced with just "I don't understand dependency injection". The article is listed second in our dev docs.
          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

          • yuri
            Member
            • Mar 2014
            • 8440

            #7
            Moreover, we have this topic covered in the beginning of the ORM docs: https://docs.espocrm.com/development...entity-manager. What could we do more?
            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

            • MaxDau
              Member
              • Nov 2022
              • 38

              #8
              Hello yurri

              I never said that the CRM was bad or that the development was poorly done. What I criticise are the sources of information. You have created a masterpiece with EspoCRM from which so much can be created.
              But if you have questions about the system, it is very difficult to find the information. The question should not be whether someone knows about dependency injection, but how easy it is to get started with the CRM. In my case, I got code on the first day with the first attempt via the documentation, which copy & paste didn't work because it was out of date.

              I want to say again that the CRM is really brilliant. And the more I learn about CRM, the more excited I get.

              The functions and examples leave so many questions unanswered that you can't just answer with "dependency injection". When you've gone through all the code and know all the casseroles, things might look different. But for a beginner to the code, you go from one question to two more. And that applies not only to programming, but also to logic.
              I have a whole list of questions that I have to answer for myself through time-consuming trial and error.

              Today I used "saveErrorHandlers" and asked myself why it is called "save". I need one for delete. No matter where I searched, there was no information on it.

              "When a record is being saved, it's possible to throw an exception".

              And what about delete?

              Of course, after some searching and trial and error, I found a good (and probably correct) solution.
              But the solution only raised another question. I didn't find anything in the docs about Conflict::createWithBody either, and was then able to answer the question by searching for how to use Conflict via my editor.

              Yes, it is all very well solved and really super easy to use. But only when you know / have found the function / class and have tested it.
              When I search for how to properly cancel a function and issue a message, I get instructions on how to build my own function, but no hint on already existing functions and how to use them.

              Apart from a few minor things like the outdated bootstrap and the limited layout, there is nothing at all wrong with the software. Only the manual is very thin.

              Comment

              • yuri
                Member
                • Mar 2014
                • 8440

                #9
                We overhauled Bootstrap, it won't be possible to ever upgrade it and there's no reasons. Someday we will rename it just to not to draw attention, so we would not come off like something outdated.

                Write manuals for everything is a work that somebody needs to do. We can't afford such expenditures at the moment. We are not a corporation, and not a large company. The huge part of the product is based on my enthusiasm and working w/o weekends for years. Why now I need to feel sorry that I didn't document enough? Such posts annoys me.

                I learned some big systems from source code before, w/o any docs. And then contributed back. Never complained about missing docs. If it's no spaghetti hell, it's not a big problem to follow through code. The system is quite simple, we had developers who learned everything w/o even asking questions. It may be difficult only in the beginning.

                > Today I used "saveErrorHandlers" and asked myself why it is called "save". I need one for delete. No matter where I searched, there was no information on it.

                Because there is no such. No need to complain that we didn't documented feature that does no exist.

                > When I search for how to properly cancel a function and issue a message.

                It's not possible to cancel the function.

                > The functions and examples leave so many questions unanswered that you can't just answer with "dependency injection".

                Starting programming in Espo requires knowing how DI works. W/o it I don't recommend trying doing anything. That's why it's listed at the top in the Backend section. If you knew how it works, you would not complain about hooks in the first post. We have reference to the article in many places specially for newcomers.

                Last edited by yuri; 12-19-2022, 09:21 PM.
                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


                • telecastg
                  telecastg commented
                  Editing a comment
                  Write manuals for everything is a work that somebody needs to do. We can't afford such expenditures at the moment. We are not a corporation, and not a large company. The huge part of the product is based on my enthusiasm and working w/o weekends for years. Why now I need to feel sorry that I didn't document enough? Such posts annoys me.
                  Perhaps this could be an area of opportunity for the development team, instead of being a constant source of annoyance and argumentative replies.

                  Maybe it would be worth exploring the cost of hiring a qualified technical writer to produce a thorough manual, with complete samples and explanations of concepts, not assuming that the reader is already familiar with the code base, or full of technical jargon that a reader is assumed to be capable of understanding.

                  This manual can be sold as a monthly or annual subscription. I believe that many other participants (at least those interested in development) would gladly pay for.

                  This comment IS NOT meant as a reason to start another debate, it is a straight forward honest suggestion of a possible revenue stream for the development team.
                  Last edited by telecastg; 12-22-2022, 06:40 AM.

                • item
                  item commented
                  Editing a comment
                  Hi @telecastg,

                  yes i completly agree.. i have from my boss +- 300euro/year for "formation". (it's nothing in IT but i work in no IT domain)
                  i have another idea, maybe a live from youtube or another platform.. 1h of lessons, 1h of question/answer.. only avaible to subscriter.
                  one time per month .. so

                  I have in the past send a mail for come to Ukrain and follow a "training" .. no response ...but i think at this moment, my boss accept

                  Yes documentation is very help and up-to-date.. Yuri have make big jobs.. and understand how many time consum to make all update or maintain or add new feature.
                  And if someone open a "extension platform for espocrm" .. it's too a opportuinity.

                  This is not a debat as you say, this is a opportuinity

                  Best Regards
              • yuri
                Member
                • Mar 2014
                • 8440

                #10
                > Conflict::createWithBody

                Such a simple methods don't require documentation. It's obvious that it creates an exception with a body. Then we see a method getBody, we see a HasBody interface. We can use IDE's 'Find Usages' to see where it's used. We will figure out that it just prints passed body to the response. That's it.

                When method is documented, it's a common practice to document what the method does. It's not usual to document how the result of the method execution can be used. It even often discouraged.
                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

                • MaxDau
                  Member
                  • Nov 2022
                  • 38

                  #11
                  You know, Yurri, you are absolutely right. Because YOU have learned from the source code of other big systems, this is the normal standard for everyone else these days.

                  I don't feel like discussing this any further. On the one hand you say that you have not enough time or capacity to document more, on the other hand you say that there is nothing to document at all...

                  After giving it some thought, I have to agree with you. My lack of knowledge of DI is the only reason I have such problems.
                  Because the huge community behind EspoCRM and the countless modules to all the apps, as they are available for other CRMs, show that THE START with the development with EspoCRM is very easy and there is no reason for criticism at all.

                  In this sense: You are right and I will be quiet.​

                  Comment


                  • esforim
                    esforim commented
                    Editing a comment
                    I suppose if you manage to figure out something, there is always the option of "posting it on forum" or doing a Pull Request on the Documentation files.

                    I have a whole thread by myself to document simple stuff I learn to do here: https://forum.espocrm.com/forum/gene...crm-and-design

                    It not anything fancy but there is a few "Like", so it help 1-2 people that thread it
                • yuri
                  Member
                  • Mar 2014
                  • 8440

                  #12
                  Learning from source is normal. It's a skill that every programmer should develop.

                  Other open source CRM systems I know don't have much more detailed dev docs than Espo. Your sarcasm here is inappropriate and rude.

                  Basically all complains you listed in the topic turn out to be invalid. Spending 1 week not figuring out how to inject entity manager to the hook and blame the documentation. When in fact it's covered enough.
                  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

                  • MaxDau
                    Member
                    • Nov 2022
                    • 38

                    #13
                    I have invested thousands of Euros in EspoCRM to find a suitable software solution. The money was simply thrown out the window. Hubspot charges $1,200 for custom objects and that every month. With a few more users and a little more scope, I am over $1,700 per month. And it's just not worth it. If there were an extension that would help me, I would buy it. If there were a proper documentation, I would also buy it. I (personally) would not buy videos or video courses now. When I am looking for something, I scan texts for keywords and look at code examples.
                    I have no problem at all with financially supporting such good software as EspoCRM. It's just that there is nothing available that I could buy and get added value from.

                    I simply object to the small mistakes. Yurri does not see them. If you know the code and how the system works, you overlook the small mistakes and understand the examples without problems. But if you are new or are just getting started, you make mistakes because you have taken them from the documentation. These are often small things. Wrong paths for imports, wrong capitalization or similar. Small things that are not a problem if you know the system. For beginners, it breaks motivation if information from the documentation (copy & paste) does not work.

                    Example:
                    application/Espo/Services
                    application/Espo/Modules/{moduleName}/Services
                    custom/Espo/Custom/Services

                    It was written exactly like this in the documentation. The correct capitalization was taken care of in everything. But moduleName is simply wrong. I also find the solution in the documentation under Modules:

                    custom/Espo/Modules/{YourModule}/ - backend (CamelCase name);

                    No real problem. Just wrong.

                    Another point is the "hidden" information.
                    I am looking for information about already existing container services of Espo. So I click on Services. There is a link to Container Services. On one of the longest pages in the documentation, at the very bottom, the very last link at "See also", there is then a link to the list of Container Services. This link is not included in the navigation. You can only access the page via the link at the bottom.

                    And the search does not work at all (for me). It costs more nerves than simply trying out code.​

                    Espo is not my project and I currently do not expect to implement any further projects with Espo. The documentation does not have to be adapted for me. I just don't understand why you don't want to understand where I see the real problem. Yurri is not writing the documentation like his diary. The documentation is for BEGINNERS. For people who don't know the code and have no idea about the system. You can't write documentation with the assumption that the reader knows the system. If I know the system, I don't need documentation anymore.

                    It can't be that you blame the beginner for not understanding the documentation because he doesn't know the code. That's like scolding a driving student because he can't drive yet. The documentation is the help to understand the system and not the code helps you understand the documentation.

                    @yurri To be personal between us. It doesn't really matter to me if what I write upsets you. I write my experiences and impressions in my posts and not love stories to Yurri. I express my opinion. You are welcome to add your opinion to my posts. But that doesn't change my experiences that I have made.

                    "Basically all complains you listed in the topic turn out to be invalid."
                    You can write that if you simply don't address and ignore some points...

                    ​But I am not here to argue. You can run your project as you want. Whether you value the opinions of others and just think about it instead of feeling attacked, it's up to you.

                    Comment


                    • rabii
                      rabii commented
                      Editing a comment
                      i understand your point, when i started i relied on documentation but tbh it was the community also that helped a lot. beside you can search code base and learn from it, anything you want you can find in codebase. Anyway just hope you are still part of this amazing community and such a wonderful product and we are here to help, if you need anything let us know we will help for sure.
                  • esforim
                    Active Community Member
                    • Jan 2020
                    • 2204

                    #14
                    One purpose of "open-source" is it "open" for people to make edit, change, contribution, etc. If you find these mistake and only keep it to yourself then only yourself will know about it, and the next person MrsMaxDau who do the same thing as you do come along and "keep it to themself". A vicious cycle of nothing ever get updated.

                    If you find an issue, and a solution is now known, perhaps the idea of "sharing is caring" is importantly now.

                    There is no issue if you want to share your opinion if it can be validated, that how I read what Yuri trying to say. This forum isn't being filter/block/required moderation before you post, you can write anything you want except for 'spam'.

                    I am no way part of the EspoCRM team, and I do not have any coding skill. So whenever someone like yourself that can code started using EspoCRM it is very good in my opinion, that is a potentially good news that EspoCRM may have newer feature, bug fixed, and contribution to the system.

                    I create this "wiki" here to collect thread that I find interesting or maybe useful, perhaps you can consider reading it to get an idea, especially the code part. telecastg (user) posted quite a few of his research (not sure if he have updated to v7 yet) which will get you an idea on what to do or where to go. But that is only 1 person, there is many other hidden coder that never do this, you can find them in the "Paid Job" section where that is the only time they post.

                    Contribute to o-data/EspoCRM-Learning-and-Design development by creating an account on GitHub.
                    Last edited by esforim; 08-09-2023, 11:25 AM.

                    Comment


                    • item
                      item commented
                      Editing a comment
                      Hi esforim,
                      emillod too have make many video for community, don't forget him.
                      telecastg, we know him

                    • DamienOD
                      DamienOD commented
                      Editing a comment
                      WOW Thank you espcrm and everyone who contributed to the WIKI.
                      as a total Newb to coding this wiki is SO valuable.

                    • esforim
                      esforim commented
                      Editing a comment
                      Haven't been update in a while as I don't have time to look at forum recently so I might have missed on many things.
                  • TomasSamohyl
                    Junior Member
                    • Jul 2024
                    • 1

                    #15
                    Hey, I'm new in EspoCRM, i had to make module which would add a field called "Find contacts" to the original dropdown menu, with the fact that when that field is clicked, all contacts with the same email will be displayed and then their first and last name will be returned to the user. Do you know how to do that?

                    Comment

                    Working...