findFirst

$rollerInfo = Roller::findFirst(array(
        'id' => 1,
));
var_dump($rollerInfo);
exit;

Regardless of has a return value to check the data, how can I determine what do you have any query to the record?



83.4k

Can you elaborate on "how can I determine what do you have any query to the record?"



6.3k

I believe OPs question is something like How to know if a query has returned anything using the ORM

    $rollerInfo = Roller::findFirst(
        array(
            'id'  => 1
        )
    );

    if ($rollerInfo) {
        //This is only true if it returned a row
    } else {
        //No results for your query
    }