# |
Apr 20th 2017, 11:49 |
Junior |
I am inside AuthAcl plugin and setting class UsersTable extends \App\Model\Table\AppTable and debug("aaaa"); in the AppTable doesn't work, any ideas why? |
# |
Apr 20th 2017, 11:40 |
crazycoder |
i am using a custom errorrenderer https://gist.github.com/anonymous/b87f711b96154aed69ad57a3d742393c |
# |
Apr 20th 2017, 11:39 |
crazycoder |
is there something more...elegant ? |
# |
Apr 20th 2017, 11:38 |
crazycoder |
guys is correct echo json_encode($this->viewVars); inside a view called after an exception ? (json request) |
# |
Apr 20th 2017, 11:31 |
xety |
Hmm nice idea, i will try that, thanks ! |
# |
Apr 20th 2017, 11:29 |
Neon1024 |
Sounds like something I’d do in a helper myself |
# |
Apr 20th 2017, 11:28 |
xety |
Hello, Someone know how can i apply a function to all the `i18nFormat` call ? Actually i'm doing that : ``` ?= ucwords($poll->end_date->i18nFormat([\IntlDateFormatter::FULL, \IntlDateFormatter::SHORT])) ? ``` But i'm tired to repeat each time the `ucwords()` function. Or maybe there is an option ? I saw nothing about that in the doc. |
# |
Apr 20th 2017, 11:07 |
inoas |
similar to always using === / !== even if type does not matter |
# |
Apr 20th 2017, 11:07 |
inoas |
then you don't have to think about if type matters or not |
# |
Apr 20th 2017, 11:07 |
inoas |
I am saying in general we should use in_array($x, $y, true) aka the default way to use things |
# |
Apr 20th 2017, 11:07 |
inoas |
https://github.com/cakephp/cakephp/pull/10561#discussion_r112426055 |
# |
Apr 20th 2017, 10:09 |
Guest3372 |
anyone who could help me with RESTful routing? :) |
# |
Apr 20th 2017, 09:59 |
Guest3372 |
hello |
# |
Apr 20th 2017, 09:41 |
crazycoder |
$this->controller->request->header('Content-type') already returns application/json |
# |
Apr 20th 2017, 09:40 |
Neon1024 |
Good luck :) |
# |
Apr 20th 2017, 09:40 |
Neon1024 |
Okay, I’m out. |
# |
Apr 20th 2017, 09:40 |
crazycoder |
i checked it via postman |
# |
Apr 20th 2017, 09:40 |
Neon1024 |
Fourth time round! |
# |
Apr 20th 2017, 09:40 |
crazycoder |
Neon1024, no |
# |
Apr 20th 2017, 09:40 |
charolastra |
Neon1024: and do the switch case inside the elements? |
# |
Apr 20th 2017, 09:40 |
crazycoder |
it is not an optimization... i have to skip the .json ext |
# |
Apr 20th 2017, 09:40 |
Neon1024 |
Back to the middleware headers.. again |
# |
Apr 20th 2017, 09:40 |
Neon1024 |
But if you had the headers you’d get true |
# |
Apr 20th 2017, 09:40 |
crazycoder |
so i must do it |
# |
Apr 20th 2017, 09:40 |
crazycoder |
Neon1024, no i think you did not understand me :D if i do debug(...is('json')) i get FALSE because i am not using .json extension |
# |
Apr 20th 2017, 09:39 |
Neon1024 |
It’s a waste of your time |
# |
Apr 20th 2017, 09:39 |
Neon1024 |
You’re investing minutes to save thousands of a millisecond |
# |
Apr 20th 2017, 09:38 |
Neon1024 |
That’s micro-optimisation |
# |
Apr 20th 2017, 09:38 |
Neon1024 |
Who cares what it checks |
# |
Apr 20th 2017, 09:38 |
crazycoder |
so i must do something like if ($this->controller->request->header('Content-type') == 'application/json') { ... } |
# |
Apr 20th 2017, 09:38 |
crazycoder |
Neon1024, no no wait..i am saying it checks the extension AND the headers...but in this case we do not need the ext checks |
# |
Apr 20th 2017, 09:37 |
Neon1024 |
charolastra: I’d use elements to build the form |
# |
Apr 20th 2017, 09:37 |
Neon1024 |
It would be a pretty crappy detector if it just relied on the extension and not the headers! |
# |
Apr 20th 2017, 09:37 |
charolastra |
hi, when having a number of views which just differ in the text but are the same otherwise (like a form with different questions), would you make an action for each of them or can i define the template in the single action? |
# |
Apr 20th 2017, 09:37 |
Neon1024 |
But you’re setting those headers in your middleware |
# |
Apr 20th 2017, 09:35 |
crazycoder |
so we cannot use it |
# |
Apr 20th 2017, 09:35 |
crazycoder |
Check to see whether the request >>>> has ‘json’ extension <<<<< and accept ‘application/json’ mimetype. <------- |
# |
Apr 20th 2017, 09:35 |
crazycoder |
Neon1024, is('json') is not good in that case |
# |
Apr 20th 2017, 09:26 |
crazycoder |
so why forcing it in cake ^? |
# |
Apr 20th 2017, 09:26 |
crazycoder |
but when i send the request through postman i already set this header |
# |
Apr 20th 2017, 09:26 |
crazycoder |
Neon1024, wait should i write it in request right ? |