-
Hello guys, I would appreciate if anyone could assist me with this problem. I have a cron job I would like to start after application boot, but I don't seem to have figured out the appropriate place to start it. I have tried the AppProvider lifecycle hooks, but it failed with 'E_IOC_LOOKUP_FAILED: Cannot resolve Adonis/Lucid/Orm namespace from the IoC Container'. Obviously, my cron job service provider depends on some of my Lucid models. Any ideas? Of course, I am using V5 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Getting same error as in here: https://forum.adonisjs.com/t/adonis-5-command-database-ioc-error/6217 import { BaseCommand } from '@adonisjs/ace'
import { Kernel } from '@adonisjs/ace'
import { inject } from '@adonisjs/fold'
import { DatabaseContract } from '@ioc:Adonis/Lucid/Database'
import { ApplicationContract } from '@ioc:Adonis/Core/Application'
@inject([null, null, 'Adonis/Lucid/Database'])
export default class Hurr extends BaseCommand {
public static commandName = 'hurr'
public static description = 'Durr'
constructor (app: ApplicationContract, kernel: Kernel, private db: DatabaseContract) {
super(app, kernel)
}
public static settings = {
loadApp: true,
}
public async handle () {
console.log(this.db)
this.logger.info('Hello world!')
}
} |
Beta Was this translation helpful? Give feedback.
Getting same error as in here: https://forum.adonisjs.com/t/adonis-5-command-database-ioc-error/6217
Maybe this solves it too :)