Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How can I generate existing model for admin?
  • Hi,
    The command below generates ok, but I want to generate it under the admin folder.

    php oil r fromdb:scaffold products
  • I found this, but what is the syntax for admin?

    fromdb: Allows you to generate models, migrations, scaffolding or admin code from existing database tables.
  • I finally found it after searching and reading through this forum.

    oil r fromdb:scaffold -a contacts
  • HarroHarro
    Accepted Answer
    For next time: most oil scripts come with a '-h' or '--help' parameter, that shows you the syntax.

    In the case of fromdb:

    Description:
      Run scaffolding or generate a model from existing database table(s).
      Database settings must be configured correctly for this to work.

    Runtime options:
      -f, [--force]       # Overwrite files that already exist
      -s, [--skip]        # Skip generating files that already exist
      -a, [--admin]       # Generate admin scaffolding code
      --all               # Generate code for all tables found in the database
      --db=<database>     # Name of the database to use

    Commands:
      php oil refine fromdb:scaffold <table_name,table_name...>
      php oil refine fromdb:scaffold --all
      php oil refine fromdb:model <table_name,table_name...>
      php oil refine fromdb:model --all
      php oil refine fromdb:help

  • Thanks Harro

  • It will be very usefull if fromdb:migration will appear for creating clean migration files from scratch ;-)
  • I added fromdb:migration earlier this week, but it's still very basic. I created an issue to keep track of what is still missing (which is substantial).
  • It's cool, Harro. You are great )

Howdy, Stranger!

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

In this Discussion