Log message #4268421

# At Username Text
# Jul 27th 2021, 08:17 dereuromark No, it can also be |void still
# Jul 27th 2021, 06:29 brandon I can't seem to find this documented anywhere - controller actions seem to require `return null;` at the end if you aren't returning a Response to keep the code clean. No examples show this return on actions. What are the suggestions? ```Return value of Inventory\Controller\SystemsController::index() must be an instance of Cake\Http\Response or null, none returned```
# Jul 27th 2021, 01:05 cnizzardini ugh: https://github.com/slevomat/coding-standard/issues/872
# Jul 27th 2021, 01:02 cnizzardini Any idea why?
# Jul 27th 2021, 01:02 cnizzardini ```use SwaggerBake\Lib\MediaType\{Generic, HalJson, JsonLd};```
# Jul 27th 2021, 01:01 cnizzardini Using cakephp code sniffer i get the following error `| ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Generic.` with grouped use declarations like this:
# Jul 26th 2021, 20:57 umer936 I think thats what i will end up doing. Thank you! I'm currently reworking the whole thing so if you think of other tips, I can most likely use them. :)
# Jul 26th 2021, 20:51 greg138 You'd need to do something like `use \App\PlotsController as BasePlotsController;` and then `extend BasePlotsController`. That's nothing to do with Cake, just standard PHP namespacing.
# Jul 26th 2021, 20:42 umer936 @greg138 That was the original thought but it complains about the controller name being used twice
# Jul 26th 2021, 20:42 alamnaryab I am inserting records in 3 tables inside a transaction
# Jul 26th 2021, 20:39 cnizzardini but thats all up to you
# Jul 26th 2021, 20:39 cnizzardini personally, if you can, i would just support both put/post on edit in your controller action
# Jul 26th 2021, 20:38 cnizzardini according to the documentation (first link) it uses POST on creates, and PUT on edits
# Jul 26th 2021, 20:37 cnizzardini are you editing an existing record
# Jul 26th 2021, 20:36 alamnaryab @cnizzardini `'type' => 'post'` worked but I do not know why it is switching when I am not specifying `'type' => 'post'`
# Jul 26th 2021, 20:33 alamnaryab I dont know why?
# Jul 26th 2021, 20:33 alamnaryab I checked HTML on even times of POST it do adds `<input type="hidden" name="_method" value="PUT">`
# Jul 26th 2021, 20:30 cnizzardini i think you want `'type' => 'post'` instead of using `'method' => 'post'`
# Jul 26th 2021, 20:28 cnizzardini https://book.cakephp.org/4/en/views/helpers/form.html#options-for-form-creation
# Jul 26th 2021, 20:28 cnizzardini try this:
# Jul 26th 2021, 20:27 cnizzardini i believe edit() does a put by default
# Jul 26th 2021, 20:27 cnizzardini ```Since this is an edit form, a hidden input field is generated to override the default HTTP method.```
# Jul 26th 2021, 20:26 cnizzardini Scroll to the part where it says
# Jul 26th 2021, 20:26 cnizzardini https://book.cakephp.org/4/en/views/helpers/form.html#starting-a-form
# Jul 26th 2021, 20:26 cnizzardini For you then
# Jul 26th 2021, 20:25 cnizzardini but i know if you create restful resources in routes some routes allow post/put/patch, i think for edit
# Jul 26th 2021, 20:24 cnizzardini heh well that will not work for me
# Jul 26th 2021, 20:24 alamnaryab http://localhost/school/guardians/add?student=119
# Jul 26th 2021, 20:23 alamnaryab no, not created specific for this method
# Jul 26th 2021, 20:21 cnizzardini Did you create a route for this?
# Jul 26th 2021, 20:15 greg138 I know that POST and PUT are generally considered pretty synonymous.
# Jul 26th 2021, 20:15 greg138 Well, how Cake is interpreting that is done entirely in PHP code that you can debug...
# Jul 26th 2021, 20:14 alamnaryab i checked network tab is also showing always `post`
# Jul 26th 2021, 20:13 greg138 If the HTML is always showing the same, check what your browser is sending.
# Jul 26th 2021, 20:07 alamnaryab HTML is also show post as `<form method="post" ....`
# Jul 26th 2021, 20:06 alamnaryab how cake php decide if a form is `post` or `put` because I also tried explicitly defining method as `<?= $this->Form->create($entity,['method'=>'post']) ?>`
# Jul 26th 2021, 20:04 alamnaryab I noticed because on odd times I am receiving flash error message while not on even times I did `debug($this->request)` and check `'REQUEST_METHOD' => 'PUT'` on even time while it is `post` on odd times
# Jul 26th 2021, 19:59 greg138 The HTML is changing, or you're seeing this in your network tab of developer tools?
# Jul 26th 2021, 19:54 alamnaryab I noticed on form submit if there is input validation error and I am not correcting it and keep on submitting 1st time `$this->reqest->is('post')` is `true` 2nd time false 3rd time true 4th time false and so on. I checked it is switching to `put` what are possible reasons.
# Jul 26th 2021, 19:46 greg138 Would it work to have your plugin controller `extend` the base version?
# Jul 26th 2021, 19:46 tyler.adam.lazenby oh my gosh... thank you