We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

find message

public static function findFirst($parameters = null, $is_valid = 0)
{
    $result = parent::findFirst($parameters);
    if(!$result)
    {
        return false;
    }
    if($is_valid)
    {
        if(ActorAbstract::$actor == 'Admin')
        {
            return $result;
        }

        $model = new Customers;
        if($result->id != $model->getDi()->get('USER_INFO')->id)
        {
            $message = new Message('你无权查看他人信息!');
            $model->appendMessage($message);
            return false;
        }
    }

    return $result;
}

I rewrote the findFirst now logic when validation does not pass also returns a result set but not data may be the caller can be normal use: stream method excuse me I want to how to do?

Is the result object that does not return when the data is empty?


950

I think you should return null when your call findFirst.

But you want to return a new object you have use meta program.