Error when insert via controller command


I create a command controller (to run in Linux schedule) that need to do an insert batch (it’s in a model). However when I execute the command in terminal I got the error ‘The table does not exist: {{%SGR_QUESTIONARIO_DIARIO}}’

The weird thing is, when I execute the same model in a normal controller (accessed via URL) it works perfectly.

localhost/my_site/web/questionario-diario/create [[color="#0000FF"]WORKS[/color]]

>_ ./yii questionario-diario/index [[color="#FF0000"]Does not WORK[/color]]


My Database is Oracle.

Just a quick thought

Even use the prefix table in db configurations the error it happens.

I don’t know why it happens.

I don’t know if the message would look like this {{%SGR_QUESTIONARIO_DIARIO}}, with or without a possible prefix in effect. If prefix is used, are you sure the prefix config is the same for web as well as console?

What about character sets?

I’m not familiarized with console in Yii 2. I will check about the prefix config in console configuration.

BTW… In my app I didn’t use prefix table, I just try to use to try the console work. So, Can I use prefix db config only in console?

config/console and config/web usin the same db config file.

I’ll try some tests here.

I returned… Lol

So, I some some tests and modifications, now when I execute the comand via terminal, it runs apparentelly without error, but when I chek the insert in my database it do not happen.