Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil CLI, Options are removed from $argv
  • Ok I have been debugging the Oil CLI lately because I was generating modules, when I set --no-migration it doesn't work, so went to the Command class and printed on console the args list to find out that all options are removed, is this wrong or I am missing something somewhere else?

    FuelPHP 1.8.
  • What platform (OS) did you test this on?

    Can you give the exact oil command you used, so we can verify and debug it if needed? 
  • windows 7, and the used command is:

    ```php oil g model proxy type:varchar[50] ip:varchar[50]  country:varchar[5]  --no-migration```
  • I don't have PHP on Windows here, but I'll have a look later.

    There have been some changes to oil recently, so it might be worthwhile to check 1.9/develop to see if you have the same issue there.
  • ok, thanks, I have checked 1.9/dev too, I have read the code of Command class, why does _clear_args() removing --options ?
  • HarroHarro
    Accepted Answer
    Because they are not arguments to the function. So they have to be filtered from the list of arguments.

    In other words, in your example, "--no-migration" is removed since it is not an argument for generate:model, it is a flag, a switch. Switches or flags are checked in the code using something like

    if ( ! \Cli::option('no-migration'))
        // generate migration code

  • ok Thanks for the clear answer I get it now, thanks.
  • Did a test locally (linux, using 1.9/develop):

    $ php oil g model proxy type:varchar[50] ip:varchar[50]  country:varchar[5]  --no-migration
    Creating model: /data/www/testhosts/fuel19dev/fuel/app/classes/model/proxy.php

    So it works fine here?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion