Logs for #cakephp

Page 3 of 36,922, showing 100 records out of 3,692,143 total, starting on record 201, ending on 300

# At Username Text
# 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
# Jul 26th 2021, 10:09 soupaahh when i point to controllerA/edit/1 the form is well displayed with magicfields and update/patchEntity is working
# Jul 26th 2021, 10:08 soupaahh boths controllers have edit method with the same code
# Jul 26th 2021, 10:08 soupaahh i  have a Controller A and the same but in a different namespace because of routing prefix
# Jul 26th 2021, 10:07 soupaahh Hi guys !
# Jul 26th 2021, 07:47 paolo.bragagni and it works
# Jul 26th 2021, 07:47 paolo.bragagni ```$service->setConfig([ 'unauthenticatedRedirect' => Router::url([ 'prefix' => false, 'plugin' => null, 'controller' => 'Users', 'action' => 'login', ]), 'queryParam' => 'redirect', ]);```
# Jul 26th 2021, 07:46 paolo.bragagni in getAuthenticationService I use the redirection in this way
# Jul 26th 2021, 07:46 paolo.bragagni and it miss the 'cake4new' part
# Jul 26th 2021, 07:45 paolo.bragagni trying to debug $Url=Router::url('/', true); before the $middlewareQueue->add(new AuthorizationMiddleware($this, [ 'requireAuthorizationCheck' => false,
# Jul 26th 2021, 07:44 paolo.bragagni and .. first of all I dont see the right Url that should be https://cakephp.local/cake4new/ etc
# Jul 26th 2021, 07:43 paolo.bragagni when a user is not authorized redirectUrl goes to https://cakephp.local/login?redirect=%2Flibri%2Fadd
# Jul 26th 2021, 07:42 paolo.bragagni but got some problems
# Jul 26th 2021, 07:42 paolo.bragagni trying to reproduce https://github.com/LordSimal/authorization/blob/master/docs/en/middleware.rst#how-to-create-a-custom-unauthorizedhandler
# Jul 26th 2021, 07:38 brandon I don't think throwing more memory at a memory leak/loop is helpful in this situation.
# Jul 26th 2021, 07:29 itsolution1014 Please try to add this code.
# Jul 26th 2021, 07:29 itsolution1014 ```ini_set('memory_limit', '1024M');``` You can fix that issue with this code.
# Jul 26th 2021, 07:24 brandon Hello, all. I am still working my way through upgrading from 3.x to 4.x. I have fixed all issues with phpstan, phpcs and rector prior to updating dependencies. I have cakephp updated to 4.0.10 (stepping up incrementally) and seem to have hit a memory leak or infinite loop. I am loading the home page and am getting `Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)`. I don't know where to start to
# Jul 26th 2021, 07:24 slackebot2 troubleshoot this issue. Any assistance would be greatly appreciated.
# Jul 26th 2021, 04:32 arthurb Got it! using query ```->query('ALTER TABLE `invoices` auto_increment = 2000;')```
# Jul 26th 2021, 03:25 arthurb Morning, in the migrations plugin is there away to set the ables AUTO_INCREMENT value?
# Jul 25th 2021, 20:55 kevin.pfeifer And i was just reminded of our discussion yesterday when i looked into the "Update" Topic in the cakephp/app readme section :)
# Jul 25th 2021, 20:49 kevin.pfeifer I was just going to type something :)
# Jul 25th 2021, 20:35 alamnaryab Thank you @st.steinkuehler I have pasted whole array and commented it whenever I will need to customize anything I will be uncomenting and making required changes.
# Jul 25th 2021, 20:04 st.steinkuehler @alamnaryab see here the list of the default templates which you can change https://github.com/cakephp/cakephp/blob/fe6fd198e33f69c1d36d5df4ac2c92d26ffa4807/src/View/Helper/FormHelper.php#L88 Once (older versions than 4) this list was linked in the book to the api doc where the list was accessible and readable, but not now...(and I don't know how to contribute to the book doc).
# Jul 25th 2021, 19:48 kevin.pfeifer you can adjust all default templates at one via https://book.cakephp.org/4/en/views/helpers/form.html#customizing-the-templates-formhelper-uses
# Jul 25th 2021, 19:38 slackebot2 `$this->Form->setTemplate(long_array)` in each `form`
# Jul 25th 2021, 19:38 alamnaryab i have created `config/myTemplate.php` and then I am calling this template with each input as ```echo $this->Form->control('fullname', [ 'templates'=>'myTemplate', 'class'=>'form-control']);``` is there any method where I can change the default template, or I do not write `'template'=>'myTemplate'` with each input I aslo do not like to write
# Jul 25th 2021, 19:15 kevin.pfeifer or you can create a custom middleware which does that splitting for you before the request gets to your controller or anywhere else
# Jul 25th 2021, 18:28 alamnaryab it says deprecated here https://api.cakephp.org/3.4/class-Cake.Routing.Router.html#_parseNamedParams
# Jul 25th 2021, 18:23 alamnaryab following above link is showing error `*Call to undefined method Cake\Routing\Router::parseNamedParams()*` is '*parseNamedParams()*' method available in cakephp4?
# Jul 25th 2021, 17:46 kevin.pfeifer or check https://book.cakephp.org/3/en/development/routing.html#handling-named-parameters-in-urls
# Jul 25th 2021, 17:45 kevin.pfeifer @alamnaryab add this to you add function ```public function add(...$params) {``` and then you will get an array of all following parameters in `$params` But you will have to manually split the key-values apart
# Jul 25th 2021, 16:52 alamnaryab Hi All `http://project.com/guardians/add/student:61/other:21` how can I get named parameters in cake4?
# Jul 24th 2021, 23:22 jojomartius ->add(new ErrorHandlerMiddleware(Configure::read('Error'))) inestead of >add(ErrorHandlerMiddleware::class)
# Jul 24th 2021, 23:22 jojomartius got it!
# Jul 24th 2021, 23:12 jojomartius yes, thank you so much so far
# Jul 24th 2021, 23:05 kevin.pfeifer well i gotta get some sleep. maybe someone else can help till tomorrow :)
# Jul 24th 2021, 23:04 jojomartius especially since removing the middleware helps
# Jul 24th 2021, 23:03 kevin.pfeifer very strange indeed
# Jul 24th 2021, 23:03 jojomartius no also not consuming error's
# Jul 24th 2021, 23:03 jojomartius ah let me check my vendors
# Jul 24th 2021, 23:02 jojomartius nope, only consuming Cache,Datasources,EmailTransport, Email, Log and Security.salt
# Jul 24th 2021, 23:01 jojomartius which means ErrorHandlerMiddleware is not looking in the right config
# Jul 24th 2021, 23:01 kevin.pfeifer or do you have ```Configure::consume( 'Error' )``` somewhere?
# Jul 24th 2021, 23:00 jojomartius contains everthing
# Jul 24th 2021, 22:59 kevin.pfeifer maybe try outputting ``` Configure::read( 'Error' )``` in your Application.php in the middleware function and see if everything is still there
# Jul 24th 2021, 22:58 jojomartius mh no if i remove it from my bootstrap, its till rendering the expcetions - but its not takeing "skipLogs" into account ,:)
# Jul 24th 2021, 22:56 kevin.pfeifer in my bootstrap.php
# Jul 24th 2021, 22:56 kevin.pfeifer well I commented out ```( new ErrorHandler( Configure::read( 'Error' ) ) )->register();``` and it still worked
# Jul 24th 2021, 22:55 jojomartius but somehow it feels bad to remove the errorhandlermiddleware
# Jul 24th 2021, 22:55 jojomartius yes, indeed thats changing the behavior completly. removing ->add(ErrorHandlerMiddleware::class) helpts that the app.php is controlling the logging behavior
# Jul 24th 2021, 22:54 kevin.pfeifer not the thing in the bootstrap.php
# Jul 24th 2021, 22:54 kevin.pfeifer ok, its definitely the ErrorHandlerMiddleware in the Application.php which causes my logic
# Jul 24th 2021, 22:53 jojomartius i removed the error handler from application.php and the nit works
# Jul 24th 2021, 22:53 jojomartius but regarding https://github.com/cakephp/app/issues/842
# Jul 24th 2021, 22:53 jojomartius true taht
# Jul 24th 2021, 22:52 kevin.pfeifer well thats a bit too harsh in my opinion ^^ If your not in sync with the app template then I would just go file by file and check what differs
# Jul 24th 2021, 22:50 jojomartius but i guess the best way is just dropping the application into a seperate folder, starting with a new cakephp/app and migrating stuff over
# Jul 24th 2021, 22:50 kevin.pfeifer let me check something
# Jul 24th 2021, 22:50 jojomartius yes, you'r right. but i guess it came with 4.0 or something. too long ago
# Jul 24th 2021, 22:48 jojomartius but the bad part is... also if i clear the skip log thing