Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Define your database with your ORM Models
  • I wrote a task that will take a set of ORM Models and generate your database from them https://github.com/jondavidjohn/fuel-initdb I personally like the flow better to fully outline your objects, relations, etc.. and then have the task generate the database for you. Now supports many-to-many
  • Hi, thank you for sharing this task, it looks really useful - I'm having a tiny bit of trouble with it however. When I run it, using your models as examples, I get the following error message:
    PHP Fatal error: Class 'Model_Comment' not found in C:\wamp\www\blog\fuel\app\tasks\initdb.php on line 127
    PHP Stack trace:
    PHP 1. {main}() C:\wamp\www\blog\oil:0
    PHP 2. Oil\Command::init() C:\wamp\www\blog\oil:38
    PHP 3. call_user_func() C:\wamp\www\blog\fuel\packages\oil\classes\command.php:99
    PHP 4. Oil\Refine::run() C:\wamp\www\blog\fuel\packages\oil\classes\command.php:0
    PHP 5. call_user_func_array() C:\wamp\www\blog\fuel\packages\oil\classes\refine.php:77
    PHP 6. Fuel\Tasks\Initdb->run() C:\wamp\www\blog\fuel\packages\oil\classes\refine.php:0
    Error - Class 'Model_Comment' not found in APPPATH/tasks/initdb.php on line 127

    I should probably mention that I'm not using the RC to run the code, but rather the latest code from github - so I'm no doubt sure that is what's causing the problem - I was just hoping that you might be able to point me in the right direction anyway :) Thank you.
  • Interesting. on the develop branch or installed via oil?
  • On the develop branch.
  • Very good thanks. Is there a similar tool that uses existing tables as the jumping off point? Generate from an sql dump or query ...?
  • Not that I know of.
  • Hi Jonathan! This useful task works very well, but I found a bug when using a table prefix:
    1146 Table 'fuel.fuel_migration' doesn't exist
    

    Please advise.
  • I just installed a fresh copy of fuel, configured the databases with table prefixes, enabled orm ran my example models through without issue, re-ran them to make sure they're removing the tables correctly with the prefixes. If you believe there is an issue here, feel free to create an issue on github, and I'll investigate further.
  • Jonathan Johnson wrote on Sunday 15th of May 2011:
    I just installed a fresh copy of fuel, configured the databases with table prefixes, enabled orm ran my example models through without issue, re-ran them to make sure they're removing the tables correctly with the prefixes. If you believe there is an issue here, feel free to create an issue on github, and I'll investigate further.
    I'll try with a fresh copy. Thanks!
  • Jonathan Johnson wrote on Sunday 15th of May 2011:
    I just installed a fresh copy of fuel, configured the databases with table prefixes, enabled orm ran my example models through without issue, re-ran them to make sure they're removing the tables correctly with the prefixes. If you believe there is an issue here, feel free to create an issue on github, and I'll investigate further.
    Installed a fresh copy of RC2.1- issue solved. Thanks again.
  • Thanks for the great tool. Do you an example of a bridge table?
  • EDIT: The download from github should have 3 example models showing, belongs_to , has many, and many-to-many relationships
  • Cool! I'll try it out! Thanks for the share!
  • Has there been any updates on this at all? I'd be keen on seeing it working :)
  • Have you tried using it on a fresh install of RC3?
  • Jonathan Johnson wrote on Wednesday 27th of April 2011:
    EDIT: The download from github should have 3 example models showing, belongs_to , has many, and many-to-many relationships
    Excellent. Thanks.

Howdy, Stranger!

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

In this Discussion