[ErrorException] Undefined index: factory on php artisan wn:resources
KevinBeckers opened this issue · 6 comments
KevinBeckers commented
Hey,
I am getting a [ErrorException] Undefined index: factory on php artisan wn:resources generator.yml
I am using lumen 5.2.
Thanks
webNeat commented
Hello,
Can you please share your generator.yml
file to help me investigate the issue ?
Thanks for using these generators
KevinBeckers commented
The file is in pastebin:
Yaml
Thanks in advance
webNeat commented
It seems to be a bug in the code. This will be fixed in the next release 2.0
KevinBeckers commented
Thx!
Deleted user commented
when is next release planned / this bug fixed ?
SolomonBR commented
here's how to fix it, update \vendor\wn\lumen-generators\src\Commands\ResourcesCommand.php
around line 109 with this:
protected function serializeField($field)
{
$name = $field['name'];
$schema = $this->convertArray(str_replace(':', '.', $field['schema']), ' ', ':');
$rules = (isset($field['rules'])) ? trim($field['rules']) : '';
if(isset($field['tags'])) {
$tags = $this->convertArray($field['tags'], ' ', ',');
} else {
$tags = '';
}
$string = "{$name};{$schema};{$rules};{$tags}";
if(isset($field['factory'])){
$string .= ';' . $field['factory'];
}
return $string;
}