# |
Jul 2nd 2019, 02:50 |
waspinator |
in `Crud.beforeFind` how would you set the id if not provided in the url? |
# |
Jul 1st 2019, 21:36 |
challgren |
@khalid I dont think it adds the limit and page because when resorting the page number will display a different data set than the current page |
# |
Jul 1st 2019, 21:09 |
khalid |
is it possible to get it? |
# |
Jul 1st 2019, 21:09 |
khalid |
It is not adding limit and page parameter from query string |
# |
Jul 1st 2019, 21:09 |
khalid |
when I am calling this on my view: $this->Paginator->sort('account_name', __('Account')) |
# |
Jul 1st 2019, 21:09 |
khalid |
Hi everyone, I have a quick question |
# |
Jul 1st 2019, 20:45 |
mdotobie |
I was trying to avoid continuing to pass the variable to each nested element. I went the route of creating a property on a `Helper` class and setting and getting that. |
# |
Jul 1st 2019, 20:19 |
mdotobie |
and then try to access this in an element later. I get the empty array value. |
# |
Jul 1st 2019, 20:18 |
mdotobie |
I have been trying `$this->set('nested', [])` within a few. And then when I enter a loop try to set `$nested['products'] = $index` |
# |
Jul 1st 2019, 20:17 |
mdotobie |
Is it possible to add an array to the viewVars |
# |
Jul 1st 2019, 19:47 |
sjorgefabi |
when I try to update some version of cake with php7 (either 2.x or 3.x), there are problems with the extension: ext-mcrypt * and apparently it has been discarded in php7 |
# |
Jul 1st 2019, 16:17 |
kyleweishaupt |
niel512: Ah changing the default UTC format might work well. Thanks for the suggestion! |
# |
Jul 1st 2019, 16:09 |
niel512 |
@kyleweishaupt, looks like you can have moment.js output a Unix timestamp or you can change 'moment.defaultFormatUtc' to not include the 'Z' |
# |
Jul 1st 2019, 16:02 |
admad |
Oh that's what you said, sorry I misread |
# |
Jul 1st 2019, 16:00 |
admad |
niel512: timestamp are always in UTC |
# |
Jul 1st 2019, 15:52 |
niel512 |
@kyleweishaupt, I'm not familiar with moment.js, if it can output a timestamp that's always assumed to be UTC so no need to change anything about it |
# |
Jul 1st 2019, 15:50 |
neon1024 |
Is there a neater or more elegant way to achieve this type of nested / hierarchical routing? |
# |
Jul 1st 2019, 15:48 |
kyleweishaupt |
It is going into the db, but was hoping to reuse the logic anywhere there's a datetime (since front-end is all moment.js based - utc). I can change the format in beforeSave/beforeMarshall, but didn't want to repeat it for every model. Thank you for the help though! :slightly_smiling_face: Much appreciated! |
# |
Jul 1st 2019, 15:46 |
niel512 |
@kyleweishaupt, not sure about a custom class. If the date is going into your Db you can put some custom code on the field to do that for you. |
# |
Jul 1st 2019, 15:43 |
sjorgefabi |
Hello, how are you ?, I make an open query, is it possible to migrate from version 2.x to 3.x ?. I tried using the tool from: https://github.com/dereuromark/upgrade, but I'm not successful. I have errors like the following: ErrorHandler is not in the implicit class map CakeSession is not in the implicit class map HtmlHelper is not in the implicit class map ................................. |
# |
Jul 1st 2019, 15:40 |
kyleweishaupt |
Is this something I can do in a custom DateTime type, so any request data get automatically adjusted? |
# |
Jul 1st 2019, 15:37 |
niel512 |
If you're passing it into a DateTime object, you think you need to strip the 'Z' and specify UTC as the TZ. i.e. new DateTime('2019-06-30T13:28:00.043', 'UTC') |
# |
Jul 1st 2019, 15:31 |
kyleweishaupt |
Tried with quoting the TandZ, without, etc. Essentially one of my dates looks like `2019-06-30T13:28:00.043Z` |
# |
Jul 1st 2019, 15:30 |
kyleweishaupt |
Typo on my part :P |
# |
Jul 1st 2019, 15:30 |
niel512 |
why is the T quoted? |
# |
Jul 1st 2019, 15:26 |
kyleweishaupt |
Does anyone know an easy adjustment to have Cake 3.8 validate datetimes in UTC coming from moment.js? I can't seem to get my custom DateTimeType to handle `YYYY-MM-DD'T'HH:MM:ss.uZ`. I keep getting the "Provided value is invalid" but can't seem to get it right. |
# |
Jul 1st 2019, 15:06 |
ndm |
@barry.chapman What's special about SAML requests? |
# |
Jul 1st 2019, 14:54 |
barry.chapman |
anyone know how to generate a saml request in cake? |
# |
Jul 1st 2019, 14:09 |
slackebot |
$newsletter_id); }) |
# |
Jul 1st 2019, 14:09 |
ndm |
``` ->where(function (\Cake\Database\Expression\QueryExpression $exp) use ($newsletter_id) { return $exp->eq('MD5(CONCAT("newsletter-", Newsletters.id))', $newsletter_id); }) ``` ``` ->where(function (\Cake\Database\Expression\QueryExpression $exp, \Cake\ORM\Query $query) use ($newsletter_id) { $func = $query->func()->md5( [$query->func()->concat(['newsletter-', 'Newsletters.id' => 'identifier'])] ); return $exp->eq($func, |
# |
Jul 1st 2019, 14:08 |
ndm |
eh, sorry, I ment expressions, not functions @david, but you could use the functions builder in conjunction with expressions of course |
# |
Jul 1st 2019, 14:00 |
ndm |
You need to use either the functions builder, or bindings |
# |
Jul 1st 2019, 14:00 |
david |
cakephp convert queries from OriginalCase to "everylowercase" |
# |
Jul 1st 2019, 13:59 |
david |
I am having issues with concat and LowerCase table names... |
# |
Jul 1st 2019, 13:48 |
ndm |
@ionas I can't quite wrap my head around that snippet... but `innerJoinWith()` is for associations, in order to join a subquery, you'd have to use `innerJoin()` or `join()`... an example of what data you have, and what you want to retrieve might help. Are trying to pull of some kind of "greatest n per group" query? |
# |
Jul 1st 2019, 13:47 |
dereuromark |
I had the bug that tags have been saved multiple times, with a count of 1 each. instead of proper reusing. So no, I didnt find another solution, this one works now. |
# |
Jul 1st 2019, 13:46 |
ricksaccous |
that prob won't work for what you're trying to do i suppose |
# |
Jul 1st 2019, 13:46 |
ricksaccous |
@dereuromark save and replace strategy? lol |
# |
Jul 1st 2019, 13:44 |
dereuromark |
admad: the problem is specifically patchEntity and uniqueness only for existing in DB ( https://github.com/dereuromark/cakephp-tags/pull/28/files#diff-33b2925318abc4cc41b83442ae327efbR170 ) it would need to do uniqueness check also on already patched data, not sure if someone already coded sth here. |
# |
Jul 1st 2019, 13:43 |
ndm |
*wouldn't |
# |
Jul 1st 2019, 13:43 |
david |
how would you do this WHERE clause in the CakePHP Way? $newsletter = $this->Newsletters->find() ->where(['MD5(CONCAT("newsletter-", Newsletters.id)) =' => $newsletter_id]) ->first(); |