Log message #4268375

# At Username Text
# 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
# Jul 26th 2021, 13:26 kevin.pfeifer the referrer is set by the browser but is not always present (see https://stackoverflow.com/questions/6880659/in-what-cases-will-http-referer-be-empty) Therefore you should always have a safety fallback which you should use if the referrer is not present
# Jul 26th 2021, 13:21 paolo.bragagni (same problem here..)
# Jul 26th 2021, 13:20 paolo.bragagni hi sometimes $a=$request->referer(); doesnt setted
# Jul 26th 2021, 12:34 paolo.bragagni Better (hope to did it in the righrt way) ...
# Jul 26th 2021, 12:32 brandon @admad turns out, I never updated the `->add(new ErrorHandlerMiddleware())` in Application.php to match the signature of the the 4.x signature. I had to disable DebugKit to see the actual error for some reason. Fixed this and the error went away.
# Jul 26th 2021, 12:29 paolo.bragagni eureka
# Jul 26th 2021, 12:24 paolo.bragagni return request->referer(); in getUrl ?
# Jul 26th 2021, 12:15 paolo.bragagni or redirect to the 'previuos page'?
# Jul 26th 2021, 12:14 paolo.bragagni in handle function inside an Handler how not redirect ?
# Jul 26th 2021, 11:20 admad @brandon you most likely have recursive errors, stick a `dd($exception)` in this method https://github.com/cakephp/cakephp/blob/cdcf54e33b860aa285c6ee9ba2e94d976fd3bdff/src/Error/Middleware/ErrorHandlerMiddleware.php#L141
# Jul 26th 2021, 10:10 soupaahh do someone have any idea on why this is occurring ?
# Jul 26th 2021, 10:09 soupaahh when i point to admin/controllerA/edit/1 the form is well displayed with magicfields and update/patchEntity is not working