# |
May 2nd 2019, 15:29 |
noel |
Here’s the problem I’m having with bake. It doesn’t seem to work for self-referencing many-to-many relationships. It detects them but is unable to write such records without error: https://stackoverflow.com/questions/55955731/how-to-get-self-referencing-many-to-many-relationship-to-work-for-cake-bake-scaf |
# |
May 2nd 2019, 15:05 |
lorro |
Got a next problem in the process of updating to cakePHP 3.7. Since removing Plugin::routes() from bootstrap.php my Plugin routes don't get loaded correctly anymore. In Application.php I have loaded the RoutingMiddleware as in the app skeleton on github. `->add(new RoutingMiddleware($this, '_cake_routes_'));` The plugin is loaded like this: `$this->addPlugin('TBApi', ['routes' => true]);` Do I miss anything here? Thanks |
# |
May 2nd 2019, 15:00 |
noel |
Cake bake doesn’t seem to do anything with any `belongsToMany` associations that it finds. Why is that? |
# |
May 2nd 2019, 14:46 |
neon1024 |
:thumbsup: |
# |
May 2nd 2019, 14:43 |
daniel.upshaw |
Thank you |
# |
May 2nd 2019, 14:43 |
daniel.upshaw |
@neon1024 That worked!! |
# |
May 2nd 2019, 14:42 |
neon1024 |
It won’t be passed into the controller method signature though |
# |
May 2nd 2019, 14:42 |
neon1024 |
Then you can get at it by inspecting the `$this->getRequest()->getParams()` |
# |
May 2nd 2019, 14:42 |
daniel.upshaw |
Hmm, I'll try that! |
# |
May 2nd 2019, 14:42 |
neon1024 |
`$routes->connect('/posts', ['controller' => 'Posts', 'action' => 'index', 'type' => 'recent'])` |
# |
May 2nd 2019, 14:42 |
daniel.upshaw |
So there might be `/blog/test-1-2-3`, or `/page/test-1-2-3` that go to the same controller |
# |
May 2nd 2019, 14:41 |
neon1024 |
Sure, you’d just put it into the route |
# |
May 2nd 2019, 14:41 |
daniel.upshaw |
Hmm |
# |
May 2nd 2019, 14:40 |
ricksaccous |
meh |
# |
May 2nd 2019, 14:40 |
ricksaccous |
i dunno exactly what you mean |
# |
May 2nd 2019, 14:40 |
ricksaccous |
passing FROM a route? |
# |
May 2nd 2019, 14:40 |
neon1024 |
Two stars in a route allows `/` and `*` I think |
# |
May 2nd 2019, 14:40 |
ricksaccous |
oh wait |
# |
May 2nd 2019, 14:40 |
ricksaccous |
forgot the difference between one or two stars but I think there is one |
# |
May 2nd 2019, 14:39 |
ricksaccous |
like "/**" at the end of the route or something |
# |
May 2nd 2019, 14:39 |
ricksaccous |
yeah i think you just make it greedy |
# |
May 2nd 2019, 14:36 |
daniel.upshaw |
We have `->setPass(['varname'])` if we use `:varname` in the route URL, but wondering about passing something that is not defined in the route URL |
# |
May 2nd 2019, 14:35 |
daniel.upshaw |
Is it possible to pass extra parameters to a controller from a route? |
# |
May 2nd 2019, 12:17 |
graziel |
so yeah i think if you just modify response and then `return $this->response;` thats all |
# |
May 2nd 2019, 12:15 |
skor |
yes, i just ned to send a 200 header |
# |
May 2nd 2019, 12:15 |
skor |
thing is that the response will not be returned exactly in between my calls to flush, so i would need to probably skip some cake code that gets executed after the controller method |
# |
May 2nd 2019, 12:14 |
graziel |
i dont see any `echo` in between ob_* so probably doesnt matter |
# |
May 2nd 2019, 12:13 |
skor |
yes, thanks, aware of that, what about ob and flush, same thing / does not matter? anyone tried this? |
# |
May 2nd 2019, 12:13 |
graziel |
@skor for setting headers you have https://book.cakephp.org/3.0/en/controllers/request-response.html#setting-headers |
# |
May 2nd 2019, 12:08 |
charolastra |
lorro: from which version did you upgrade? i'm woking on 3.4 -> 3.7 |
# |
May 2nd 2019, 12:08 |
skor |
Hi everyone! I’m processing sales data through webhooks, once I have verified the webhook data is legitimate, I want to send a response to the client that 200 all ok, and carry on my script execution, so the server calling me does not have to wait for my process to finish, is there a cake way to do this: ``` |
# |
May 2nd 2019, 12:07 |
lorro |
Actually no, didn't do that :slightly_smiling_face: Done it now, and all working now. Thanks a lot! |
# |
May 2nd 2019, 12:03 |
charolastra |
good point! |
# |
May 2nd 2019, 11:58 |
graziel |
did you update also other files like https://github.com/cakephp/app/blob/master/bin/cake.php |
# |
May 2nd 2019, 11:47 |
charolastra |
seems like the whole Application.php gets ignored |
# |
May 2nd 2019, 11:40 |
charolastra |
bootstrapCli() doesn't seem to be called either. i can put in invalid expressions and it doesn't complain :/ |
# |
May 2nd 2019, 11:39 |
lorro |
Apparently yes. Have left it out now and am getting the same error response. I also tested to put it back in bootstrap.php by Plugin::load and that works. Loading the plugin in bootstrapCli() doesn't fix it either by the way |
# |
May 2nd 2019, 11:37 |
neon1024 |
CLI and App bootstrap are different methods https://github.com/cakephp/app/blob/master/src/Application.php#L87 |
# |
May 2nd 2019, 11:34 |
charolastra |
lorro: what happens i you leave the addPlugin() in bootstrap() out completly? i think it gets ignored completly for CLI |
# |
May 2nd 2019, 11:32 |
slackebot |
(shell) functions that need to be running. Apparently there the bootstrap values don't get loaded in the application. Any idea what could be causing this? |
# |
May 2nd 2019, 11:32 |
lorro |
Hi all, I recently updated to version 3.7, don't know if my issue is directly related to that. Before I loaded my plugins by Plugin::load in bootstrap.php and have now moved that code to Application.php to reflect the changes in the newest cakePHP. I load it like this: `$this->addPlugin('Eav', ['bootstrap' => true]);` the bootstrap of the plugin gets loaded fine when I open the application in the browser. However I've also got some CLI |