-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
RESTful help #2165
RESTful help #2165
Conversation
@MGatner Here ya go - some ideas. Not "proven" yet, so user beware! |
Wow thanks! I’ll look through this tonight - I like what I see. |
@andreportaro Those changes are done automatically by the git commit pre-hook, and that is what needs fixing. My PR probably has more formatting changes than normal, because it has been in the works for so long. |
I see! Is that pre-commit hook versioned anywhere? |
The pre commit hook runs our standard code sniffer, codeigniter4/codeigniter4-standard. My guess is that is the appropriate place to change things. The good news is that once that is updated, the formatting changes will percolate through the system automatically, over time :) It may make for some funny PRs for a bit, with lots of formatting changes, but it will settle down :) |
Not ready - the code coverage has revealed a flaw in the presenter routing. |
Hmm - ControllerTesterTest is failing travis-ci, and I don't see why. |
Fixed the travis-ci issue with phpunit annotations to run resource & controller tests in separate processes, preventing test cross-contamination. |
{ | ||
$this->modelName = $which; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should'nt we force the name and object to be cleared here once something has been introduced?
It's just that if we are assigning the model for the first time, everything is fine, but if we are changing the model it will not work well anymore because we will have the class name of the previous model and the new object or the previous object and with the name of the new class.
Maybe something like this:
if (is_object($which))
{
$this->model = $which;
$this->modelName = null;
}
else
{
$this->model = null;
$this->modelName = $which;
}
This includes two classes to make building a RESTful API easier:
When time permits (a future PR), I will submit/propose a RESTFIlter, to automatically translate between JSON & XML data in & out.
I developed this about six months ago, with & for my students, and am only now getting around to proving its correctness with unit testing. That has been problematic, as you might gather from the code. Not to worry - it is getting cleaner every day :)
Completes #1765