Log message #4268387

# At Username Text
# 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
# Jul 26th 2021, 19:44 greg138 https://book.cakephp.org/3/en/core-libraries/collections.html#sorting: "By default, `SORT_NUMERIC` is used"
# Jul 26th 2021, 19:43 tyler.adam.lazenby ```$collection = new Collection($contact_list->contacts); $sorted = $collection->sortBy(function($contact) { return $contact->first_name; }, SORT_ASC);```
# Jul 26th 2021, 19:43 tyler.adam.lazenby still not working
# Jul 26th 2021, 19:42 alamnaryab Hi in my add action, if there is error once request method is `post` next time `put` it is switching each time. my code is too lengthy by it is as below ```try{ $data = $this->request->getData(); }catch(Exception $ex){ }```
# Jul 26th 2021, 19:40 tyler.adam.lazenby those are entities
# Jul 26th 2021, 19:40 tyler.adam.lazenby oh wait
# Jul 26th 2021, 19:39 tyler.adam.lazenby can anybody tell me why this isn't iterating in the order that I am expecting (by first_name) ```$collection = new Collection($contact_list->contacts); $sorted = $collection->sortBy('first_name', SORT_ASC)->compile(); foreach ($sorted as $contact) {```
# Jul 26th 2021, 18:26 umer936 Yeah I'm reanalyzing how to handle it where I'm not pointing to a Controller not present, but need a quick fix as I rework things.
# Jul 26th 2021, 18:25 umer936 Oohh i see. Thank you!
# Jul 26th 2021, 16:52 kevin.pfeifer there is no built in fallback functionality if a given controller is not present (why point to it in the first place?) You could extend/create your own ExceptionRenderer Class `vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php` and set it as the `Error.exceptionRenderer` in your app.php In there you could check the exception and current requested URL and then react to it.
# Jul 26th 2021, 16:28 umer936 Currently, I put j
# Jul 26th 2021, 16:28 umer936 Hi all. Quick question. I have functions in the base eg: `/src/Controller/PlotsController.php` and also in a Plugin `/plugins/xxxx/src/Controller/PlotsController.php` Is there a way to route so that it checks the PlotsController in the plugin for a match, then goes to the root level src if there is not a match?
# Jul 26th 2021, 16:10 kevin.pfeifer but could be that I just missunderstand contains with custom fields right now :thinking_face:
# Jul 26th 2021, 16:04 kevin.pfeifer If RegistrationCategories BelongToMany InsurancePolicies shouldn't the `registration_category_id` column be in the junction table between RegistrationCategories and InsurancePolicies? And not on the InsurancePolicies like your first code example shows?
# Jul 26th 2021, 15:56 birdy247 It must be a common problem with the ORM
# Jul 26th 2021, 15:56 birdy247 @greg138 yes its annoying, but we get expections in this case
# Jul 26th 2021, 15:53 greg138 "Premature optimization" and all that...
# Jul 26th 2021, 15:52 greg138 That's been my solution too. Not because of the errors you're seeing, but because of the number of times I tried to get just what I need, and then need something else, and spend extra time trying to figure out why that field is all blank in the output...
# Jul 26th 2021, 15:18 birdy247 This has come up a few times and we end up removing any selects and just pull back everything
# Jul 26th 2021, 15:17 birdy247 Any ideas on how best to proceed?
# Jul 26th 2021, 15:13 birdy247 The InsurancePoliciesRegistrationCategories association is not defined on InsurancePolicies.
# Jul 26th 2021, 15:13 birdy247 ```'RegistrationCategories.InsurancePolicies' => [ 'fields' => [ 'id', 'name', 'confirmation_email_text', 'registration_category_id' ], 'InsurancePoliciesRegistrationCategories' => [ 'fields' => [ 'registration_category_id' ] ], ],```
# Jul 26th 2021, 15:13 birdy247 If we do this
# Jul 26th 2021, 15:09 birdy247 But yet the error message suggests we need to select a field from it
# Jul 26th 2021, 15:09 birdy247 InsurancePoliciesRegistrationCategories table doesnt exist
# Jul 26th 2021, 15:09 birdy247 We are using cake magic to handle the join table
# Jul 26th 2021, 15:08 birdy247 Because RegistrationCategories BelongToMany InsurancePolicies
# Jul 26th 2021, 15:08 birdy247 You are required to select the "InsurancePoliciesRegistrationCategories.registration_category_id"
# Jul 26th 2021, 15:08 birdy247 We then get this message
# Jul 26th 2021, 15:07 birdy247 ```'RegistrationCategories.InsurancePolicies' => [ 'fields' => [ 'id', 'name', 'confirmation_email_text', 'registration_category_id' ] ],```
# Jul 26th 2021, 15:07 birdy247 This is in a contain
# Jul 26th 2021, 15:07 birdy247 We are hitting a weird issue with selecting data in queries
# Jul 26th 2021, 15:07 birdy247 Hi
# Jul 26th 2021, 14:01 paolo.bragagni it fallback to default page seems ok