Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

the error in the model

Hi! I have a model of "Users"

it contains the code:

public static function find($parameters = null) { return parent::findFirst($parameters); }

on the way out, I get the error:

Declaration of App\Models\Users::find($parameters = NULL) must be compatible with Phalcon\Mvc\Model::find($parameters = NULL)

where did I go wrong?



2.7k
Accepted
answer

Re-declaration of method must contain return type - https://github.com/phalcon/cphalcon/blob/master/phalcon/Mvc/Model.zep#L1401

So it need to be like this:

public static function find($parameters = null): \Phalcon\Mvc\Model\ResultsetInterface


1.3k

thanks!

Re-declaration of method must contain return type - https://github.com/phalcon/cphalcon/blob/master/phalcon/Mvc/Model.zep#L1401

So it need to be like this:

public static function find($parameters = null): \Phalcon\Mvc\Model\ResultsetInterface