Log message #4189725

# At Username Text
# Jun 17th 2019, 00:04 graziel try ->setLocaleFormat('MM/dd/yyyy')
# Jun 17th 2019, 00:03 swimboy It’s frustrating. I know I have it working in one app I built two years ago, but I can’t figure out what I did.
# Jun 17th 2019, 00:02 graziel well you could write your own data type and set it manually in table
# Jun 17th 2019, 00:02 swimboy I dug through my old code, and the last time I just threw up my hands and wrote a function to change the format manually after submitting my form. It was a PITA because I had to call it every time I used a date in a form.
# Jun 17th 2019, 00:01 graziel something silly
# Jun 17th 2019, 00:01 graziel hm i remember i had something simmilar issue but i cant remember what it was
# Jun 16th 2019, 23:59 swimboy Besides, no matter what I change, the only format that gets accepted is “2019-06-16”
# Jun 16th 2019, 23:57 swimboy It says it uses icu
# Jun 16th 2019, 23:54 graziel i cant remember which format it takes icu or iso :S
# Jun 16th 2019, 23:53 swimboy Still doesn’t work with ```Type::build('date') ->useImmutable() ->useLocaleParser() ->setLocaleFormat('M/dd/y');```
# Jun 16th 2019, 23:51 graziel try forcing your format with ->setLocaleFormat
# Jun 16th 2019, 23:51 swimboy I have it like this: ```Type::build('date') ->useImmutable() ->useLocaleParser();```
# Jun 16th 2019, 23:50 swimboy I also have `Type::build('date')->useLocaleParser();` in my bootstrap
# Jun 16th 2019, 23:50 graziel so you need Type::build('date') not datetime
# Jun 16th 2019, 23:49 swimboy date
# Jun 16th 2019, 23:49 graziel or time or date?
# Jun 16th 2019, 23:49 graziel and you have datetime type in database?
# Jun 16th 2019, 23:28 swimboy Still running into problems. I tried putting `Type::build('datetime')->useLocaleParser();` in my controller, and in the bootstrap.php (where the other Type::build settings are), but neither had any effect.
# Jun 16th 2019, 23:17 graziel : )
# Jun 16th 2019, 23:16 swimboy Thanks!
# Jun 16th 2019, 23:15 graziel https://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
# Jun 16th 2019, 23:12 slackebot1 “2019-06-16” in the field, it accepts the value.
# Jun 16th 2019, 23:12 swimboy I know I solved this once in an older version of CakePHP, but a) I don’t remember how I did it, and b) I think it’s handled differently now. My default locale is set to “en-US” in config/app.php and my dates are displaying as “6/16/2019" as I expect; but I’m using a plain text field instead of the default three menus for input forms, and trying to save a record in the same format gets rejected as being invalid. If I manually type
# Jun 16th 2019, 22:44 joey.mukherjee Weird... some how the hydration is messing up. I had to set enableHydration (false) on my query and use it that way.
# Jun 16th 2019, 22:25 joey.mukherjee I json_encode an array in my beforeSave routine in my table. I see it save correctly into my database as a string. However, when I load it, some of my strings are set to '' or empty. Not all of them though. Any ideas?
# Jun 16th 2019, 20:48 stephenzgalbraith Trying to get the authentication plugin to work with v4 and getting this error
# Jun 16th 2019, 20:48 slackebot1 <stephenzgalbraith>
# Jun 16th 2019, 17:20 admad also you should be using `'controller' => 'Plots'` not `'controller' => '/plots'`
# Jun 16th 2019, 17:19 admad @joey.mukherjee cause the router adding current plugin to URLs by default. Add `'plugin' => false` to the URL array to prevent that
# Jun 16th 2019, 16:19 joey.mukherjee Basic question: I am trying to use the CakeDC/Users plugin with v3.7. I have a menubar.ctp as my element being included in my Template/Layout/default.ctp I have a: <a href="<?php echo $this->Url->build (['controller' => '/plots', 'action' => 'index']); ?>">Plots</a> and a <a href="profile">Profile</a>. When I go to the profile page, my Plots link now has a users prepended to it. Why?
# Jun 16th 2019, 16:06 rogerpro Thank you very much, @ndm and @admad. Actually, my specific goal is to run tests for a plugin intended for an app that uses token auth. At some point, it seemed easier to me to test controller actions directly instead of making the auth work in test dev. Or, more important, test plugin functionality no matter which auth config is set up in the app.
# Jun 16th 2019, 15:41 admad https://github.com/ADmad/cakephp-i18n/blob/master/tests/bootstrap.php#L11-L24
# Jun 16th 2019, 15:39 ndm A bit old, but the concept is still the same: https://stackoverflow.com/questions/35565066/setting-up-cakephp-3-plugin-testing/35611216#35611216
# Jun 16th 2019, 15:39 slackebot1 directory (`../../vendor/bin/phpunit`).
# Jun 16th 2019, 15:39 ndm @rogerpro If you plan to make a standalone plugin, then you need to clear the auto-generated `tests/bootstrap.php` file and use it to set up an application environment that pulls in the core's bootstrap. If you're making a plugin that's part of your app, then you need to use the phpunit installation of the app, and run it either from the app's root and pass the plugin path (`vendor/bin/phpunit plugins/ContactManager`), or run it from your plugin
# Jun 16th 2019, 15:09 rogerpro So everyone using running tests from a standalone plugin that has a bootstrap file should face the issue, I guess.
# Jun 16th 2019, 15:08 rogerpro Got it, it’s here but not loaded. Hope this is not happening only to me :)
# Jun 16th 2019, 15:07 rogerpro ``` total@aadd2f92f77f:~/mnt/my_app_name/plugins/ContactManager$ cat vendor/cakephp/cakephp/tests/phpunit_aliases.php <?php if (class_exists('PHPUnit_Runner_Version')) { if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) { trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR); ```
# Jun 16th 2019, 15:07 rogerpro It is actually here:
# Jun 16th 2019, 14:58 admad I don't remember from where/how it's supposed to be auto loaded
# Jun 16th 2019, 14:58 admad For some reason this file isn't being loaded for you https://github.com/cakephp/cakephp/blob/master/tests/phpunit_aliases.php