Giter Club home page Giter Club logo

Comments (3)

sebastiandedeyne avatar sebastiandedeyne commented on August 24, 2024

Not sure how this is happening because autodiscovery is kickstarted from EventSourcingServiceProvider, which shouldn't run when Laravel's auto-discovery is disabled.

Can you verify EventSourcingServiceProvider's register or boot method are running and find out why?

Possible issues:

  • Did you manually register the service provider in config/app.php?
  • Is the service provider cached?

from laravel-event-sourcing.

n1crack avatar n1crack commented on August 24, 2024

Did you manually register the service provider in config/app.php?

Its registered in the AppServiceProvider.php

    /**
     * Register any application services.
     */
    public function register(): void
    {
        if ($this->app->environment('local')) {
            $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
            $this->app->register(TelescopeServiceProvider::class);
        }
    }

after calling
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
image

after changing this line, it works.

'auto_discover_projectors_and_reactors' => [
   // app()->path(),
],

my composer.json has

    "extra": {
        "laravel": {
            "dont-discover": [
                "laravel/telescope"
            ]
        }
    },

so I come up with a solution without commenting the app_path, so In the EventSourcingServiceProvider.php

changing

        (new DiscoverEventHandlers())
            ->within(config('event-sourcing.auto_discover_projectors_and_reactors'))
            ->useBasePath(config('event-sourcing.auto_discover_base_path', base_path()))
            ->ignoringFiles(Composer::getAutoloadedFiles(base_path('composer.json')))
            ->addToProjectionist($projectionist);

to :

        (new DiscoverEventHandlers())
            ->within(config('event-sourcing.auto_discover_projectors_and_reactors'))
            ->useBasePath(config('event-sourcing.auto_discover_base_path', base_path()))
            ->ignoringFiles([
                ...File::allFiles(app_path('Providers')),
                ... Composer::getAutoloadedFiles(base_path('composer.json'))
            ])
            ->addToProjectionist($projectionist);

I can create a PR but if there is another way I would like to know.

from laravel-event-sourcing.

spatie-bot avatar spatie-bot commented on August 24, 2024

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

from laravel-event-sourcing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.