Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM Feature Request
  • Hello, I just recently started porting several of my apps to fuelphp and wanted to ask for a feature request. My apologies for posting it here but the feature request link on doesn't appear to be working. I've been using a custom active record pattern ORM for 5 years and am excited by the functionality provided by fuelphp's orm package. That said I wanted to ask if it would be possible to optionally modify the package so that each model could extend a base class containing properties representing the table fields. That way it becomes possible to autocomplete or lookup table fields on each model instance using an IDE without having to reference the datamodel. This approach has saved me lots of dev time that would have been lost referencing the proper table fields. I'm working on complex datamodels with many entities which makes it difficult for me to memorize all their exact attributes. Is there any way to make it possible to: 1. Automatically populate properties of a loaded instance that exist as properties of the object and are found in the "$_properties" array? This would make it possible to access the values directly from the instance. $model->some_property
    Note: I was able to do this using an observer callback on the "after_load" event on the model however this created a new problem (2). 2. The primary key property can't be populated on the object because the property representing the primary key can't be changed without throwing an error. Ex: $model->im_a_pk = 1; // NOT ALLOWED 3. By having the model extend a base class with the properties representing the fields, the ORM doesn't detect any changes on save and fails to update the corresponding record. 4. When saving a new instance, the ORM assumes that all the existing properties have been modified and inserts NULL for properties that have not been explicitly set instead of allowing the db to specify the defaults. Essentially, I'm requesting an optional behavior that would allow the model to work with inherited object properties in a get and set context. $model->some_prop = 'new val'; // SUPPORTED
    $model->some_prop; // NOT SUPPORTED Thanks again for the wonderful framework!
  • The link is dead since we moved to a new hosting provider. It's a work in progress. You can report bugs, issues, feature requests etc here:

Howdy, Stranger!

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

In this Discussion