Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ErrorException] Undefined index: factory on php artisan wn:resources #14

Closed
KevinBeckers opened this issue Aug 16, 2016 · 6 comments · Fixed by #19
Closed

[ErrorException] Undefined index: factory on php artisan wn:resources #14

KevinBeckers opened this issue Aug 16, 2016 · 6 comments · Fixed by #19
Labels

Comments

@KevinBeckers
Copy link

Hey,

I am getting a [ErrorException] Undefined index: factory on php artisan wn:resources generator.yml
I am using lumen 5.2.

Thanks

@webNeat
Copy link
Owner

webNeat commented Aug 16, 2016

Hello,

Can you please share your generator.yml file to help me investigate the issue ?

Thanks for using these generators

@KevinBeckers
Copy link
Author

The file is in pastebin:
Yaml

Thanks in advance

@webNeat
Copy link
Owner

webNeat commented Aug 25, 2016

It seems to be a bug in the code. This will be fixed in the next release 2.0

@webNeat webNeat added the bug label Aug 25, 2016
@KevinBeckers
Copy link
Author

Thx!

@beechit
Copy link

beechit commented Oct 4, 2016

when is next release planned / this bug fixed ?

@SolomonBR
Copy link

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;
}

webNeat added a commit that referenced this issue Jan 12, 2017
- Bug fixed: [Undefined index: factory](#14)
- Feature added: [Check if file already exists before generating it](#11)
- Feature added: [Support for additional columns like nullableTimestamps() and softDeletes() in migrations](#12)
- Feature added: [Specifying namespace for `wn:resource` and `wn:resources`](#18)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants