Log message #4202438

# At Username Text
# Sep 10th 2019, 08:19 challgren But $this->Url I only use 5 times
# Sep 10th 2019, 08:19 slackebot #3498db; border-radius: 5px; box-sizing: border-box; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: bold; margin: 0; padding: 12px 25px; text-transform: capitalize; border-color: #3498db;">View Audit</a>```
# Sep 10th 2019, 08:19 challgren ```<a href="<?= $this->Url->build(['controller' => 'EnergyAudits', 'action' => 'view', $energyAudit->id], ['fullBase' => true]) ?>" target="_blank" style="display: inline-block; color: #ffffff; background-color: #3498db; border: solid 2px
# Sep 10th 2019, 08:18 admad you are using string `'/favicon-32x32.png'` not url array :slightly_smiling_face:
# Sep 10th 2019, 08:16 challgren `<img src=“<?= $this->Url->image(‘/favicon-32x32.png’, [‘fullBase’ => true]) ?>” width=“41" height=“41” alt=“Logo” align=“center” style=“border: none; -ms-interpolation-mode: bicubic; max-width: 100%;“>`
# Sep 10th 2019, 08:16 challgren I use it one time
# Sep 10th 2019, 08:15 challgren When I first started cake I though it was needed but pretty much stopped using html helper for things like that
# Sep 10th 2019, 08:15 admad My opinion is there's no need to :slightly_smiling_face:
# Sep 10th 2019, 08:14 admad yup
# Sep 10th 2019, 08:14 challgren Like /img/?
# Sep 10th 2019, 08:14 admad does any use URL arrays to generate URLs for assets?
# Sep 10th 2019, 08:14 admad guys your feedback here would be helpful https://github.com/cakephp/cakephp/pull/13630#issuecomment-529765323
# Sep 10th 2019, 08:13 challgren Yeah… Everyone must be wrapping up projects
# Sep 10th 2019, 07:55 alexdd55976 its quiet week in here
# Sep 10th 2019, 07:07 alexdd55976 morning fellows
# Sep 10th 2019, 06:20 javier.villanueva morning all
# Sep 10th 2019, 01:58 latenal never mind, I removed Subscriptions from the expression and it worked
# Sep 10th 2019, 01:34 latenal Hey guys! How do you increment a value in database? ``` $subscriptionsTable = TableRegistry::getTableLocator()->get('Subscriptions'); $subscriptionsTable->updateAll( ['Subscriptions.users = Subscriptions.users + 1'], ['Subscriptions.id' => $company->subscription_id] ); ``` this does not work
# Sep 9th 2019, 16:34 xavier83ar @neon1024 I use to have a loginRedirect() method, usually in UsersController, then AuthComponent login redirect is set to this method, there is the logic to dinamically redirect the user, maybe by its rol or profile
# Sep 9th 2019, 15:44 neon1024 Every time I try and use JSON it just throws in loads `\` everywhere!
# Sep 9th 2019, 15:44 neon1024 Stupid AuditStash plugin
# Sep 9th 2019, 15:38 admad dirty but simple and effective :slightly_smiling_face:
# Sep 9th 2019, 15:37 neon1024 Do I just write to the components config every time?
# Sep 9th 2019, 15:37 neon1024 What is a neat approach to managing dynamic redirect urls with the AuthComponent?
# Sep 9th 2019, 14:49 info315 @admad ok thanks
# Sep 9th 2019, 14:49 admad @info315 removing that statement is the right thing to do since the request has already been handled by the handler when you called `parent::process()`
# Sep 9th 2019, 14:43 info315 Hi, I try to port my AppAuthenticationMiddleware from cake 3.8 to the current 4.x but I stuck at this error: `substr() expects parameter 1 to be string, null given Error in: ROOT/vendor/cakephp/cakephp/src/Http/ControllerFactory.php, line 83 ` If i remove `$response = $handler->handle($request);` from my middelware the issue is gone, but i think that's not the solution
# Sep 9th 2019, 14:03 ndm You'd still have to reassign the connection after that though, or reset / remove the respective tables from the table registry. There's 1000 and 1 ways to abstract that away somewhere, the event stuff in the answer was just an example.
# Sep 9th 2019, 13:55 challgren https://api.cakephp.org/3.3/class-Cake.Datasource.ConnectionManager.html#_dropAlias
# Sep 9th 2019, 13:55 itmpls How can I revert it back to default once I alias it?
# Sep 9th 2019, 13:52 challgren @itmpls maybe https://api.cakephp.org/3.3/class-Cake.Datasource.ConnectionManager.html#_alias
# Sep 9th 2019, 13:51 itmpls Manually I can solve it with `$table->Users->setConnection()`. is there a cleaner way if I . had to do . this for 5-6 . tables?
# Sep 9th 2019, 13:51 ndm Changing the connection for `$table` won't change the connection for containments, you'd have to change the connection for those tables too.
# Sep 9th 2019, 13:50 itmpls My service requests table ($table) hasMany Users and on containment cake tries to cache/grab all the columns on the default connection, not on the connection $table is set to
# Sep 9th 2019, 13:49 itmpls I have 2 database connections and I am pulling data from both. Doing a `foreach ($connections as $connection) { $table->setConnection($connection); $table->find()->contain('Bar'); });` but when I contain `Bar` Cake does a `SHOW FULL COLUMNS FROM Bar` on the *default* connection and an error is thrown because it doesn't check that table on the dynamic connection I set
# Sep 9th 2019, 13:47 ndm I don't really know what exactly you mean by that? Reverting what exactly? And what is "all the other stuff"?
# Sep 9th 2019, 13:44 itmpls just came across this which may solve my problem
# Sep 9th 2019, 13:44 itmpls @ndm - in your answer here, https://stackoverflow.com/a/48372895/145190 is there a way to revert connection to default after all the other stuff?
# Sep 9th 2019, 13:39 y_lin @ndm Thanks a lot. I will try it!
# Sep 9th 2019, 13:36 ndm @y_lin That's the security component, it has nothing to with CSRF, it handles stuff like form tampering protection. If you don't need that kind of protection for your AJAX requests, the most simple solution is to disable it for those specific actions. Otherwise you'd also have to generate and add a security token to your AJAX requests. See for example how `\Cake\View\Helper\FormHelper::secure()` is doing that.
# Sep 9th 2019, 13:34 itmpls I think this is . the same problem I'm having