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

createMany : expects an array of values instead received array on adonis repl #262

Closed
suciptoid opened this issue Dec 12, 2017 · 1 comment
Assignees

Comments

@suciptoid
Copy link

Trying createmany function on adonis repl but receive this exception. createMany still working on seeder.

> let payloadArray = [{username:'showcheap',email:'admin@sucipto.net',password:'admin',name:'Sucipto'}]
undefined
> payloadArray instanceof Array === false
false
> await use('App/Models/User').createMany(payloadArray)
InvalidArgumentException: E_INVALID_PARAMETER: User.createMany expects an array of values instead received array
    at Function.invalidParameter (/home/sucipto/Dev/js/devhunt/node_modules/@adonisjs/generic-exceptions/src/InvalidArgumentException.js:52:12)
    at Function.createMany (/home/sucipto/Dev/js/devhunt/node_modules/@adonisjs/lucid/src/Lucid/Model/index.js:449:10)
    at repl:1:30
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at REPLServer.onLine (repl.js:440:10)
    at emitOne (events.js:120:20)
    at REPLServer.emit (events.js:210:7)
    at REPLServer.Interface._onLine (readline.js:279:10)
    at REPLServer.Interface._line (readline.js:626:8)
    at REPLServer.Interface._ttyWrite (readline.js:906:14)
    at REPLServer.self._ttyWrite (repl.js:509:7)
    at ReadStream.onkeypress (readline.js:158:10)
> 

@thetutlage
Copy link
Member

Ohhh yeah. As you saw payloadArray instanceof Array returns false when running in REPL. I have remove all these statements from the codebase and instead use Array.isArray method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants