Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Ormauth Admin Scaffold Using Oil
  • I've been reading and can't seem to find it.  Is there a way to create an Admin scaffold for user management using the existing Ormauth tables?

    oil refine fromdb:admin users
  • HarroHarro
    Accepted Answer
    You can use

    oil refine fromdb:scaffold users --admin

    to run admin scaffolding instead of scaffolding.

    It will generate new models, so after this you'll have to change those so that they simply extend the model in Auth (and be empty otherwise).
  • Not as robust as I'd like - since all of the "edit", "create" doesn't work without additional coding.  However, your answer got me further down the road.  Thanks.
  • Sorry to revive an old thread. I can make a new one if need be. So I just tried to do this, and it failed wit this exception:

    $ oil refine fromdb:scaffold users --admin
    Database method Fuel\Core\Database_PDO_Connection::list_indexes is not supported by Fuel\Core\Database_PDO_Connection

    How come the list_indexes function isn't implement for the Database_PDO_Connection class?
  • Because the SQL to generate a table, index or column list is RDMBS dependent, and if you use the generic PDO driver, the driver doesn't know which RDBMS you are using.

    So don't use the generic PDO driver, use the platform driver instead.
  • Ah okay. I guess I was mistaken. I thought the point of the PDO was that it was an intermediary that took care of the specific differences between different RDBMSes behind the scenes. Like doing a list_indexes on a MariaDB connection would have the PDO use that RDBMS's syntax, and same for Postgres, etc.

    I didn't realize that it implemented only the pieces that were common between them.
  • No, PDO just provides a generic interface towards PHP, it doesn't do anything with regards to platform specifics.

    The mysql, dblib, sqlite and sqlsrv drivers in Fuel all utilize PDO, but have a platform specific schema and list_tables() / list_columns() implementation, to deal with this.
  • Okay, gotcha. As always, thanks for the info Harro!
  • One more question actually. So then does the mysqli driver in Fuel utilize actual mysqli? While the mysql Fuel driver utilizes PDO, not the old mysql PHP driver?
  • Yes. And Yes. The old mysql driver isn't used by Fuel anymore.
  • Okay, so heads up to anyone trying to do this:
    If you do

    $ oil refine fromdb:scaffold users --admin

    to create scaffolding based on the ORM auth packages users table then it will create a migration in your app to create the users table that is a duplicate of the one in the auth package. So if you don't get rid of that migration, then, if you do an 

    $ oil refine migrate

    it will fail since that table already exists.

Howdy, Stranger!

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

In this Discussion