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

Model::__callStatic() enhancements #14467

Merged
merged 7 commits into from
Oct 15, 2019

Conversation

zsilbi
Copy link
Member

@zsilbi zsilbi commented Oct 14, 2019

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Small description of change:

Phalcon\Mvc\Model::__callStatic() now throws an exception if the called method is unknown.
Added tests for Phalcon\Mvc\Model::__callStatic().

Thanks,
zsilbi

@zsilbi
Copy link
Member Author

zsilbi commented Oct 14, 2019

Magic methods using Model::__callStatic() now accept 0 and null and also an empty string as parameter.

These function calls are now valid:

Robots::findByField(null);
Robots::findByField("");
Robots::findByField(0);

Robots::findFirstByField(null);
Robots::findFirstByField("");
Robots::findFirstByField(0);

Robots::countByField(null);
Robots::countByField("");
Robots::countByField(0);

@codecov
Copy link

codecov bot commented Oct 14, 2019

Codecov Report

Merging #14467 into 4.0.x will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##            4.0.x   #14467      +/-   ##
==========================================
+ Coverage   67.67%   67.69%   +0.02%     
==========================================
  Files         482      482              
  Lines      111331   111360      +29     
==========================================
+ Hits        75339    75390      +51     
+ Misses      35992    35970      -22

@zsilbi zsilbi changed the title Changed Model::__callStatic() to throw an exception for unknown calls Model::__callStatic() enhancements Oct 14, 2019
sergeyklay
sergeyklay previously approved these changes Oct 14, 2019
@niden niden added 4.0 enhancement Enhancement to the framework labels Oct 14, 2019
@niden niden merged commit 6298372 into phalcon:4.0.x Oct 15, 2019
@niden
Copy link
Member

niden commented Oct 15, 2019

Thank you @zsilbi

@zsilbi zsilbi deleted the model-callstatic-exception branch October 15, 2019 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to the framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants