Log message #4266401

# At Username Text
# Jun 25th 2021, 07:04 paolo.bragagni no way
# Jun 25th 2021, 07:04 paolo.bragagni $this->viewBuilder()->setLayout('ajax');
# Jun 25th 2021, 06:58 paolo.bragagni it still use the default layout
# Jun 25th 2021, 06:58 paolo.bragagni cant use the 'ajax template
# Jun 25th 2021, 06:58 paolo.bragagni if ($this->request->is('ajax')) { $this->layout = 'ajax'; $this->render('addAjaxBelong', 'ajax'); }
# Jun 25th 2021, 06:58 paolo.bragagni hey
# Jun 25th 2021, 04:35 greg138 Out of curiosity, why do you decode and then re-encode the file contents? Any chance that some part of that is failing to give what you expect?
# Jun 24th 2021, 23:15 slackebot add into the controller ```$body = $this->request->getBody()->getContents(); dd($body);``` I get this [appname]\src\Controller\WoocommerceController.php#L61\^]8;;\ ""
# Jun 24th 2021, 23:15 tyler.adam.lazenby What I get when I send in the request like this ```$signature = 'GKZ8mf9PiGLgAykuvlvcSEvUgw53IyNw0DfWv3lSbwo='; $this->configRequest(['headers' => [ Configure::read('WooCommerce.webhook.headers.signature') => $signature, 'content-type' => 'application/json', 'accept' => '*/*', ]]); $this->post(Router::url(['controller' => 'Woocommerce', 'action' => 'sendOrderEmail']), json_encode($this->json));``` and then
# Jun 24th 2021, 23:13 kevin.pfeifer @ricmelero I would have to try to reproduce that routing error later/tomorrow. But you can of course create an issue in the cakephp repo
# Jun 24th 2021, 23:12 ricmelero I read, a test, sorry
# Jun 24th 2021, 23:11 tyler.adam.lazenby because I am getting a response on dd() commands inside that controller action
# Jun 24th 2021, 23:11 tyler.adam.lazenby yeah That's not the issue
# Jun 24th 2021, 23:11 tyler.adam.lazenby yes
# Jun 24th 2021, 23:11 tyler.adam.lazenby I think sooo
# Jun 24th 2021, 23:11 kevin.pfeifer @tyler.adam.lazenby have you enabled route loading in your tests? https://book.cakephp.org/4/en/development/testing.html#loading-routes-in-tests
# Jun 24th 2021, 23:09 ricmelero that's $this here? a controller?
# Jun 24th 2021, 23:09 ricmelero I'm using Cakephp 4 by the way
# Jun 24th 2021, 23:08 tyler.adam.lazenby wait I might need to make this header for application/json
# Jun 24th 2021, 23:07 ricmelero it's weird that the same call with same arguments, works one time and fails...
# Jun 24th 2021, 23:06 ricmelero I guess I can handle it, in fact I can add the "lang" key in other places.. but I just wanted to know if I was doing something bad or if I should open a bug...
# Jun 24th 2021, 23:06 tyler.adam.lazenby ```$path = join(DS, [ROOT, 'tests', 'Resource', 'order.json']); $this->json = json_decode(file_get_contents($path), TRUE);```
# Jun 24th 2021, 23:05 tyler.adam.lazenby to simulate an order being sent from my webhook
# Jun 24th 2021, 23:05 tyler.adam.lazenby I am just trying to make it so that the post is sending the json that I have gotten from the file.
# Jun 24th 2021, 23:04 ricmelero @kevin.pfeifer the first time is built while seting up the AuthenticationService, but then I call in other places like the templates
# Jun 24th 2021, 23:04 tyler.adam.lazenby ```$signature = 'GKZ8mf9PiGLgAykuvlvcSEvUgw53IyNw0DfWv3lSbwo='; $this->configRequest(['headers' => [ Configure::read('WooCommerce.webhook.headers.signature') => $signature ]]); $this->post(Router::url(['controller' => 'Woocommerce', 'action' => 'sendOrderEmail']), json_encode($this->json));```
# Jun 24th 2021, 23:04 tyler.adam.lazenby I am not sure why, but my json is not being passed to the controller action when I run this as a test
# Jun 24th 2021, 23:02 kevin.pfeifer so you cant pass the already matched (correct) first url to the place, where you need it again (2nd url) later?
# Jun 24th 2021, 22:55 ricmelero which seems to be intentioned, but leads to a weird an unpredictable behavior
# Jun 24th 2021, 22:51 ricmelero As far as I can see, here is the issue src/Routing/Route/Route.php:366 ```// Remove defaults that are also keys. They can cause match failures foreach ($this->keys as $key) { unset($this->defaults[$key]); }```
# Jun 24th 2021, 22:50 ricmelero what I was trying to do is to setup a default lang... but it seems that Route::match() is mutating internals of the route, so after first match, the defaults changes, making next match call fails
# Jun 24th 2021, 22:48 ricmelero this is the route definition, I'm using the AdMad/I18n Routing plugin
# Jun 24th 2021, 22:48 ricmelero ```$builder->connect('/', ['controller' => 'Authentication', 'action' => 'login', 'lang' => 'es'], RouteNames::login);```
# Jun 24th 2021, 22:47 ricmelero I use a class with const for named routes
# Jun 24th 2021, 22:47 ricmelero Sorry, RouteName::login is ['_name' => 'login']
# Jun 24th 2021, 22:47 ricmelero I'm having a weird issue with routes, that fails the second time I build the same url, in this case a named route: ```$loginUrl = Router::url(RouteNames::login); $loginUrl = Router::url(RouteNames::login);``` The first call works ok, building login url, but second fails
# Jun 24th 2021, 21:10 marius.treu my current approach is with amphp executing the resulting SQL genereated by an cakephp query
# Jun 24th 2021, 21:10 marius.treu hi all, is there a way to create async queries with the cakephp ORM?
# Jun 24th 2021, 20:12 rightscoreanalysis my bad, I frogot to prefix themodel with the plugin name
# Jun 24th 2021, 20:02 rightscoreanalysis anyone able to help with a cake2 question, in my Api model: public $useTable = false; in another model I have: ClassRegistry::init('Api'); but I get: *Error:* Table _apis_ for model _Api_ was not found in datasource _default_.
# Jun 24th 2021, 16:37 richard no worries, i always thought it was weird too ;)