Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Find by unique field (that is not primary ID) and return ORM model instance
  • I have an unique field in my table that is not ID. Is there something like find by id method, but for finding on another field, which would return me an ORM model instance? If I use find()->where('unique_field' => 'unique_value') it returns me an Orm\Query object ... Thanks
  • Ok found away around this, still want to know if this is the only way?
    $assets = Model_Asset::find()->where('uploader_id', $uploader_id);
    $asset = $assets->get_one();
    //$asset is now ORM_Asset instance
    
  • If you want data, you always have to 'get' it.

Howdy, Stranger!

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

In this Discussion