# |
Aug 20th 2019, 12:48 |
spriz |
and `ini_set('intl.default_locale', Configure::read('App.defaultLocale'));` also AFAIK |
# |
Aug 20th 2019, 12:47 |
spriz |
also make sure `date_default_timezone_set(Configure::read('App.defaultTimezone'));` is in your `bootstrap.php` |
# |
Aug 20th 2019, 12:47 |
spriz |
I don't remember which one |
# |
Aug 20th 2019, 12:47 |
spriz |
or `nl-NL` |
# |
Aug 20th 2019, 12:47 |
spriz |
they should also be `nl_NL` |
# |
Aug 20th 2019, 12:47 |
spriz |
Also check for Date::, FrozenDate::, Time:: and FrozenTime:: `setDefaultLocale()` calls |
# |
Aug 20th 2019, 12:46 |
martin |
APP_DEFAULT_TIMEZONE is not set |
# |
Aug 20th 2019, 12:46 |
spriz |
try setting this in `app.php`: ``` 'defaultLocale' => 'nl_NL', 'defaultTimezone' => 'Europe/Amsterdam', ``` |
# |
Aug 20th 2019, 12:45 |
neon1024 |
Hah, yeah, good point @spriz |
# |
Aug 20th 2019, 12:45 |
neon1024 |
Try outputting a format which includes the timezone |
# |
Aug 20th 2019, 12:45 |
spriz |
is `APP_DEFAULT_TIMEZONE` env var set to `UTC`? |
# |
Aug 20th 2019, 12:45 |
neon1024 |
..and output the same |
# |
Aug 20th 2019, 12:45 |
neon1024 |
Changing that setting should save to your DB at Amsterdam time |
# |
Aug 20th 2019, 12:44 |
neon1024 |
It shouldn’t be |
# |
Aug 20th 2019, 12:44 |
martin |
but when I format time it will be UTC when the object is UTC |
# |
Aug 20th 2019, 12:43 |
martin |
``` 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'nl_NL'), 'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'Europe/Amsterdam'),``` |
# |
Aug 20th 2019, 12:43 |
neon1024 |
https://github.com/cakephp/app/blob/master/config/app.default.php#L54 |
# |
Aug 20th 2019, 12:43 |
neon1024 |
I think you set it in app.php using the locale |
# |
Aug 20th 2019, 12:42 |
martin |
default timezone of product is Europe/Amsterdam |
# |
Aug 20th 2019, 12:42 |
martin |
now I need to do `->i18nFormat('YYYY-MM-dd HH:mm:ss', 'Europe/Amsterdam')` |
# |
Aug 20th 2019, 12:42 |
martin |
is it possible to give i18nFormat a default timezone? or do I always need to set the timezone? |
# |
Aug 20th 2019, 12:41 |
martin |
old database, not my choice :( |
# |
Aug 20th 2019, 12:38 |
spriz |
Why would one not keep things in UTC until it hits the frontend? :( |
# |
Aug 20th 2019, 12:34 |
martin |
also fixed in cake 4? :P |
# |
Aug 20th 2019, 12:34 |
martin |
When I save an UTC time object to a Europe/Amsterdam database, it saves the utc time instead of adding 2 hours :( |
# |
Aug 20th 2019, 12:25 |
ndm |
@khalid Yes, queries (instances of `\Cake\Database\Query` or `\Cake\ORM\Query`) are query builder objects. You can create the former via connection objects (`Connection::newQuery()`), and the latter via table objects `Table::query()`. |
# |
Aug 20th 2019, 12:24 |
spriz |
@eax that sounds funky. Is it downright an event listener that listens to events fired in another PHP process? |
# |
Aug 20th 2019, 12:22 |
khalid |
I am sorry I just kind of new to cake still.. |
# |
Aug 20th 2019, 12:22 |
khalid |
@ndm thanks, Query::insert() is Querybuilder right? |
# |
Aug 20th 2019, 12:20 |
ndm |
@khalid `Table::saveMany()` is the slowest of them all (there are no `callbacks` and `validate` options btw, that's 2.x options), `Query::insert()` is faster, and then there's one additional way, that is to write plain SQL (make sure that you're using prepared statements if you chose that way!), which would be the fastest way on CakePHP level. |
# |
Aug 20th 2019, 12:04 |
khalid |
I am already using savemany with array('callbacks' => false, 'validate' => false) |
# |
Aug 20th 2019, 12:03 |
khalid |
there is no faster way |
# |
Aug 20th 2019, 12:03 |
khalid |
@ndm thanks for your reply, so if I want to insert like 1million records, then I have no option except save or save many? or I go through QueryBuilder and write insert queries right? |
# |
Aug 20th 2019, 11:12 |
ndm |
There is none, the 3.x connection manager stores the instantiated connection objects in a registry object that lives in a protected property for which there is no public accessor available. |
# |
Aug 20th 2019, 11:05 |
val |
We have `ConnectionManager::sourceList()` in 2.x. What's its alternative in 3.x? |
# |
Aug 20th 2019, 10:58 |
ndm |
No, it's not, there's not even a `DboSource` class in 3.x, that's 2.x stuff. In 3.x you can use the query builder to create insert statements without using the ORM. |
# |
Aug 20th 2019, 10:49 |
khalid |
is insertMulti part of cake3.x? |
# |
Aug 20th 2019, 10:46 |
khalid |
Thank you for the help. |
# |
Aug 20th 2019, 10:46 |
khalid |
I am struggling with initialisation of DBO source. |
# |
Aug 20th 2019, 10:45 |
khalid |
hi everyone, how to use DboSource insert multi in a model? |
# |
Aug 20th 2019, 10:41 |
slackebot |
Thanks |