Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phalcon model interface doens't allow false return #13947

Closed
ruudboon opened this issue Apr 5, 2019 · 4 comments
Closed

Phalcon model interface doens't allow false return #13947

ruudboon opened this issue Apr 5, 2019 · 4 comments
Labels
bug A bug report status: medium Medium

Comments

@ruudboon
Copy link
Member

ruudboon commented Apr 5, 2019

When I overload the findFirst and run a query that doesn't match I get the following error:
fatal error: Uncaught TypeError: Return value of MyModel::findFirst() must implement interface Phalcon\Mvc\ModelInterface, bool returned in xxxxx on line xx

Looks like the findFirst can return false but isn't allowed by the interface. Unsure why this only show when overloading the method.

@ruudboon ruudboon changed the title Return value of App\Models\Users::findFirst() must implement interface Phalcon\Mvc\ModelInterface, null returned Phalcon model interface doens't allow null return Apr 5, 2019
@ruudboon ruudboon changed the title Phalcon model interface doens't allow null return Phalcon model interface doens't allow false return Apr 5, 2019
@talal424
Copy link

talal424 commented Apr 5, 2019

return null or an instance of Phalcon\Mvc\ModelInterface

@ruudboon
Copy link
Member Author

ruudboon commented Apr 5, 2019

@talal424 Interface doesn't allow null.

@niden niden mentioned this issue Apr 5, 2019
4 tasks
@ruudboon
Copy link
Member Author

ruudboon commented Apr 5, 2019

Fastest bug fix ever! Thnx @niden

@ruudboon ruudboon closed this as completed Apr 5, 2019
niden added a commit that referenced this issue Apr 6, 2019
niden added a commit that referenced this issue Apr 6, 2019
niden added a commit that referenced this issue Apr 6, 2019
niden added a commit that referenced this issue May 9, 2019
@niden niden added the 4.0 label Jun 21, 2019
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
@SmartyGunjan
Copy link

phalcon 4.1 php 7.4 getting the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants