# |
Jul 10th 2017, 13:46 |
lorenzo |
wherever you were writing `[StripesTable::class, 'webhookHandler'],` |
# |
Jul 10th 2017, 13:46 |
birdy247 |
@lorenzo where would I put that? |
# |
Jul 10th 2017, 13:45 |
lorenzo |
You should maybe do something like this ```function (...$params) { return TableRegistry::get('Stripes')->webhookHandler(...$params); }``` |
# |
Jul 10th 2017, 13:45 |
spriz |
how do I define log levels when using monolog? :thinking_face: |
# |
Jul 10th 2017, 13:45 |
birdy247 |
Ok |
# |
Jul 10th 2017, 13:44 |
lorenzo |
your method is not static |
# |
Jul 10th 2017, 13:44 |
lorenzo |
`StripesTable::class, 'webhookHandler'],` is the syntax for static methods |
# |
Jul 10th 2017, 13:38 |
birdy247 |
or dispatch events from a static method (is that wrong)? |
# |
Jul 10th 2017, 13:37 |
birdy247 |
Can I keep it dynamic? |
# |
Jul 10th 2017, 13:32 |
birdy247 |
I dispatch events from this method, so not sure if it being static is correct |
# |
Jul 10th 2017, 13:31 |
birdy247 |
I get a strict error saying it needs to be static |
# |
Jul 10th 2017, 13:31 |
birdy247 |
but then when I do $callable($data) |
# |
Jul 10th 2017, 13:31 |
birdy247 |
and is_callable returns true |
# |
Jul 10th 2017, 13:31 |
birdy247 |
'handler' => [StripesTable::class, 'webhookHandler'], |
# |
Jul 10th 2017, 13:31 |
birdy247 |
I pass in this |
# |
Jul 10th 2017, 13:29 |
birdy247 |
it tries to pass the data in the request to the Stripes webhookHandler |
# |
Jul 10th 2017, 13:29 |
birdy247 |
and then if the endpoint matches |
# |
Jul 10th 2017, 13:29 |
birdy247 |
My GridHook plugin attahces the middleware before router |
# |
Jul 10th 2017, 13:29 |
birdy247 |
and a "webhookHandler" method |
# |
Jul 10th 2017, 13:28 |
birdy247 |
I have a "Stripes" tables |
# |
Jul 10th 2017, 13:28 |
lorenzo |
what method are you trying to call? |
# |
Jul 10th 2017, 13:27 |
birdy247 |
How can I call a method in a Table dynamically |
# |
Jul 10th 2017, 13:23 |
birdy247 |
I cant work out how to use the handler function |
# |
Jul 10th 2017, 13:21 |
birdy247 |
and making it middleware |
# |
Jul 10th 2017, 13:20 |
birdy247 |
@lorenzo I am following the Gridhook plugin |
# |
Jul 10th 2017, 13:17 |
birdy247 |
Is there a way I can call it dynamically? |
# |
Jul 10th 2017, 13:14 |
birdy247 |
But keep getting a strict error about it being a static method |
# |
Jul 10th 2017, 13:14 |
birdy247 |
I am trying to call a callable method from middleware |
# |
Jul 10th 2017, 13:03 |
hmic |
like: $this->Html->link('go there', ['controller' => 'anotherone', 'action' => 'someone', $this->request->params['pass'][0]]); |
# |
Jul 10th 2017, 13:03 |
clementcrown |
ok... |
# |
Jul 10th 2017, 13:02 |
hmic |
so you can use it to build another url |
# |
Jul 10th 2017, 13:02 |
hmic |
- like i said. |
# |
Jul 10th 2017, 13:02 |
hmic |
how do you get that info in a template? |
# |
Jul 10th 2017, 13:02 |
hmic |
yes |
# |
Jul 10th 2017, 13:01 |
inoas |
http://localhost/cakedkolibrary/books/view/3, this is my url, i want to get that "3" and send it to another controller so I can save it in my database table ... sounds like request action to me |
# |
Jul 10th 2017, 13:01 |
hmic |
he did not ask for anything you are talking about inoas |
# |
Jul 10th 2017, 13:01 |
hmic |
he asked for the information in the currently rendered template - this how he gets that. |
# |
Jul 10th 2017, 12:59 |
inoas |
cakephp3? |
# |
Jul 10th 2017, 12:58 |
inoas |
I am using it and I can only say it is the path of failure |
# |
Jul 10th 2017, 12:58 |
inoas |
you can use request action... but it is pretty bad imho |
# |
Jul 10th 2017, 12:58 |
inoas |
or create model layer logic (a class and some functions) where you pass down the request params that hmic referes to |