Good evening,
after upgrading to 4.1.0 on Windows 10 all my applications stopped working. When approaching the site(s), I receive this kind of error:
Fatal error: Declaration of BLABLAMODEL::findFirst($parameters = NULL) must be compatible with Phalcon\Mvc\Model::findFirst($parameters = NULL): ?Phalcon\Mvc\ModelInterface in D:\xampp744\htdocs\app\models\BLABLAMODEL.php on line 151
I solved this by changing
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}
to
public static function findFirst($parameters = null): \Phalcon\Mvc\ModelInterface
{
return parent::findFirst($parameters);
}
This seems to work so far, but if my findFirst() contains an array of options which limits the columns returned, like
$article = SupplierUpload::findFirst([
'conditions' => 'article = '.$tmp[1],
'columns' => 'article, dispo, season, price'
]);
I get this error
Fatal error: Uncaught TypeError: Return value of SupplierUpload::findFirst() must implement interface Phalcon\Mvc\ModelInterface, instance of Phalcon\Mvc\Model\Row returned in D:\xampp744\htdocs\app\models\SupplierUpload.php on line 90
If I get this right, the internal Model::findFirst should always return a \Phalcon\Mvc\ModelInterface, but with limited columns, it returns a \Phalcon\Mvc\Model\Row? Or did I fix the findFirst declaration the wrong way?
Thank you!