Getting started as a developer in EspoCRM...

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • yuri
    replied
    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.

    Leave a comment:


  • MaxDau
    replied
    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.

    Leave a comment:


  • yuri
    replied
    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?

    Leave a comment:


  • yuri
    replied
    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.

    Leave a comment:


  • esforim
    commented on 's reply
    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.

  • item
    replied
    Just for information :

    This IA can help incredible..

    the response is correct for me

    I will ask DI

    Leave a comment:


  • yuri
    replied
    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.

    Leave a comment:


  • yuri
    replied
    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.

    Leave a comment:


  • item
    replied
    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.

    Leave a comment:


  • MaxDau
    started a topic Getting started as a developer in EspoCRM...

    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.​
Working...