Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Adding default properties to ORM Model when using Oil
  • Hi, Currently when using Oil to generate models, the ID, created_at and updated_at fields are added automatically. I'd like to add an 'active' property (basically a tinyint) to my default model class, so that it is added when using the command line. Is this fairly easy to achieve with Fuel? I don't really want to start hacking around the project files - I'll only break something! Rich
  • The code that generates the model is in oil/views/scaffolding/orm/model.php. You can copy that to app/views/scaffolding/orm/model.php and modify it to your liking. Remember, one of FuelPHP's strenghts is that (almost) everything is extendible!
  • Excellent, thank you. Is there something similar I can do with the SQL to actually create the database then? I guess the default migration - this doesn't seem to be with everything else.
  • Do you mean the code that generates the migration? See oil/classes/generate/migration/actions.php. I'm not sure how to extend this single file, as Oil classes are not aliased. I'll ask around.

Howdy, Stranger!

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

In this Discussion