Hey there,
I'm wondering why findFirst method returns a instance of Phalcon\Mvc\Model instead of the extending class. At least this is what the API doc tells me so IntelliJ 2018.1 with the Phalcon Plugin complains about this
function getUser(int $id): User {
return User::findFirst(3); // Expected return type User but got Phalcon\Mvc\Model
}
$user = getUser(3);
Whats the proper way to do this here?
Better pass the model as param to the constructor like new User(User::findFirst(3))
or use db adapter directly?
Thanks in advance