andersao / andersao/l5-repository
Changing config of generator.basePath doesn't work for generating Provider and Request file
- Lingua principale
- PHP
- Stelle
- 4.2k
- Fork
- 880
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Changing `generator.basePath` in config/repository.php doesn't work for `Provider` and `Request` file.
For Example:
We changed the config/repository.php file:
```php
'basePath' => base_path('packages/XcWong/LabAssets/src'),
'rootNamespace' => 'XcWong\\LabAsset\\',
```
But the generated RepositoryServiceProvider.php or Requests files were always located in app/Providers or app/Requests folder.
Then there comes the bug:
In file `prettus/l5-repository/src/Prettus/Repository/Generators/Commands/BindingsCommand.php`, line 60:
```php
// generate repository service provider
if (!file_exists($bindingGenerator->getPath())) {
$this->call('make:provider', [
'name' => $bindingGenerator->getConfigGeneratorClassPath($bindingGenerator->getPathConfigNode()),
]);
```
The code checks if there is the specific provider file in the `basePath` folder but always creates the provider file in `app\Providers`. It seems wrong if you has changed the `basePath` in the config file .
The function getPath:
```php
/**
* Get destination path for generated file.
*
* @return string
*/
public function getPath()
{
return $this->getBasePath() . '/Providers/' . parent::getConfigGeneratorClassPath($this->getPathConfigNode(), true) . '.php';
}
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.