Announcement

Collapse
No announcement yet.

How to override a manager present in \Espo\Core\Container?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to override a manager present in \Espo\Core\Container?

    Hi tanya , yuri

    It want to override the loadOutput function and loadLog function present in Container. Is there a way to do it?

  • #2
    Hi,

    There's no way.

    Comment


    • #3
      yuri

      Can you please add a way in espocrm?

      All I expect is to create an object of the Manager class and keep it running.

      Something like loadCustomManagers in Container class.

      So here's the use case. I need errors reported immediately and I use sentry for that. Sentry reports errors immediately when it occurs through email with few lines of code.

      composer.json

      Code:
      {
        "require": {
          "sentry/sentry": "1.9.0"
        }
      }
      SentryManager.php

      PHP Code:
      require_once __DIR__ "/vendor/sentry/sentry/lib/Raven/Autoloader.php";
      Raven_Autoloader::register();
      $client = new Raven_Client($sentry-dsn);
      $client->setEnvironment("production");
      $client->setAppPath("$appPath");
      $client->setRelease(Raven_Client::VERSION);
      $client->install(); 
      The above php code is more than enough to report all exceptions/errors without having to catch it. And if you're hosting sentry application on your own then it's free to use.

      So, if I put this in a Manager and create an instance of manager having this code, it will start sending error reports to the email that is registered in sentry.
      Last edited by theBuzzyCoder; 02-05-2019, 06:52 AM.

      Comment


      • #4
        yuri,

        You can also integrate sentry with monolog using

        Comment


        • #5
          yuri

          Hey, we have Custom Service Container which Is implemented for our sentry integration as mentioned above. The new release 6.0.9 have updates on
          espocrm/application/Espo/Core/Container.php file where

          Code:
          private function getLoader(string $name): ?Loader
          {
              $loaderClassName = $this->getLoaderClassName($name);
              if (!$loaderClassName) {
                  return null;
              }
              return $this->injectableFactory->create($loaderClassName);
          }
          Here our custom Class is not of type Espo\Core\Loaders\Loader. We have a custom class that needs to be loaded.

          How to override the espocrm/application/Espo/Core/Container.php class to customize the getLoader function?
          Last edited by Ananya K; 01-07-2021, 08:54 AM.

          Comment


          • #6
            I figured out the solution and my loader class is working fine.

            Comment


            • espcrm
              espcrm commented
              Editing a comment
              Share solution?

          • #7
            espcrm

            Description: Follow Up with Issue: #1495 The new release 6.0.9 has this feature support. But, the new release changes are not supporting this feature as expected. I am trying to integrate the sentr...

            Comment

            Working...
            X