AkrilliA / laravel-beyond

Create Laravel classes in a domain driven way (insired by Spatie Laravel Beyond CRUD)
ISC License
219 stars 24 forks source link

Must not be accessed before initialization #100

Closed napruzzese closed 9 months ago

napruzzese commented 9 months ago

When a person try to create Model, Enum etc for a Domain that not works!

php artisan beyond:make:enum Users/UserStatusEnum

 ┌ On which domain do you want to add your Enum ────────────────┐
 │ Users                                                        │
 └──────────────────────────────────────────────────────────────┘

   Error 

  Typed property AkrilliA\LaravelBeyond\NameResolver::$directory must not be accessed before initialization

  at vendor/akrillia/laravel-beyond/src/NameResolver.php:90
     86▕         $this->namespace = sprintf(
     87▕             $this->command->getNamespaceTemplate().'%s',
     88▕             $this->appOrDomain,
     89▕             $this->command->getType()->getNamespace(),
  ➜  90▕             $this->directory ? '\\'.$this->directory : '',
     91▕         );
     92▕ 
     93▕         $this->path = sprintf(
     94▕             '%s/'.$this->command->getFileNameTemplate(),

      +15 vendor frames 

  16  artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

When u make php artisan beyond:make:model Users/User may not work, when u try php artisan beyond:make:model Users.User it works!

alexanderkroneis commented 9 months ago

We‘ll investigate asap, thanks for reporting!

regnerisch commented 9 months ago

Fixed in v7.0.0-beta.8