Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
can i retrieve model name from an ORM\Query instance?
  • i have helper function that takes ORM\Query from various models to add pagination info to the query then return the result
    now i want to add sorting too to this function but the problem that not all models have 'modified' attribute so i want to check for this BEFORE getting the result!
    i can see the model attribute in the ORM\Query instance but its protected :(
    any help?
  • also can i get model Key field name from any model instance?
  • Wat do you mean by 'attribute'? A table column?

    You can use the "property()" method to access the models property definition.

    There is also a method "primary_key()" to retrieve the PK from a model.

Howdy, Stranger!

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

In this Discussion