Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Help with find record

posted by norman784 8 years ago

Hi im recently find this unframework, and love the way it works, but there are few things that i use with another ORM that I've not found here, things like

$Model->find($options);

I see some examples for find records but It was passing their unique indexes in their constructor

$Model = new Model($id);
$Model = new Model(array('email'=>$email));

But i need to find records just like above!

Thanks for the help

So if you aren't searching via a primary or unique constraint, it is always a possibility that more than one record will match the conditions you have specified. Because of this, you need to use fRecordSet. If you visit the fRecordSet page, there is quite a bit of documentation about how to do all different sorts of searches.

Once you have an fRecordSet, you can call the method fRecordSet::getRecord() to retrieve a single fActiveRecord object, you just may end up triggering an fEmptySetException if no records were found. You can always use fRecordSet::count() to check the number of returned record before trying to use ::getRecord().

posted by wbond 8 years ago