Log message #4184073

# At Username Text
# Apr 22nd 2019, 20:26 lorenzo That’s not how the env variables feature is supposed to be used. You should be providing env variables, not loading them from a file in production
# Apr 22nd 2019, 19:45 sdevore I use a linked file config/local.php that are the over-rides for producation/staging/development it is not checked in to source control and the deployment scripts handle linking it
# Apr 22nd 2019, 18:24 phantomwatson I'm not sure how to distinguish between `/staging.sitename.com` and `/sitename.com` using environm- oh hell, it can just check which directory it's in. Staring me right in the face the whole time.
# Apr 22nd 2019, 18:22 admad Having an uncommited file per environment is fine too
# Apr 22nd 2019, 18:20 admad Environment variables is the way to go
# Apr 22nd 2019, 17:30 slackebot read in `bootstrap.php`, but that doesn't feel right. Does anyone have input about whether this is a realistic concern and what their personal approach is?
# Apr 22nd 2019, 17:30 slackebot `bootstrap.php` that get committed and pulled by production, but now I'm uncertain about being able to do that in a way that intuits what the environment is and doesn't expose a vulnerability. I would just rely on environment variables (e.g. `ENV_MODE = development`) but that wouldn't work for distinguishing between staging and production on the same server. I could have an uncommitted "what environment is this" file in the root of each site that gets
# Apr 22nd 2019, 17:30 phantomwatson The way I've been handling different configurations for different environments (dev, staging, production) is by checking the current hostname. I'm concerned that someone could do some DNS fiddling and request a production site using a URL just meant for internal development, like `sitename.localhost`, and then have the production site load in development mode. It would be convenient to continue having a single version of `app.php` and
# Apr 22nd 2019, 16:53 ricksaccous yeah
# Apr 22nd 2019, 16:35 challgren @ricksaccous so basically you copy the precompiled binary into docker
# Apr 22nd 2019, 16:33 ricksaccous wkhtmltopdf in docker, lell
# Apr 22nd 2019, 16:33 ricksaccous @challgren https://github.com/Modicrumb/dockerfiles
# Apr 22nd 2019, 14:40 admad ah, I see you already ddid
# Apr 22nd 2019, 14:39 admad @steinkel just open PR's against the branches you forked off, I'll create new branches and then the update target branch for the PRs later tonight
# Apr 22nd 2019, 14:35 arnis Hello. Can someone tell me how to autostart sessions (so that session cookie is set and so on..) on latest cake?
# Apr 22nd 2019, 13:56 steinkel @admad we've forked and upgraded to 4.x https://github.com/CakeDC/cakephp-csvview/tree/4.x and https://github.com/CakeDC/bootstrap-ui/tree/4.x shall we wait for a cake-4.x branch or send the PR to master?
# Apr 22nd 2019, 09:26 dereuromark see plugins in awesome list
# Apr 22nd 2019, 09:02 kgb.acct.personal Why is 'remember me' auth option not in CakePHP 3?
# Apr 22nd 2019, 07:43 savant there seem to be a few examples of installing it in docker, just via cursory internet glance :slightly_smiling_face:
# Apr 22nd 2019, 07:14 challgren Ok I’ll do that was kind of trying to avoid that
# Apr 22nd 2019, 06:57 savant @challgren why is installing WkHtmlToPdf painful? Seems it would be easier if you control the host os…
# Apr 22nd 2019, 04:00 waspinator or this in your controllers `initialize()` function ``` public function initialize() { parent::initialize(); $this->loadModel('ModelName'); } ```
# Apr 22nd 2019, 03:59 waspinator or if its an associated model use `$this->ThisModelName->AssociatedModelName`
# Apr 22nd 2019, 03:58 waspinator @hollistergraham123 it has to be the model the controller belongs to. otherwise you need to use `use Cake\ORM\TableRegistry;` and `$ModelName = TableRegistry::get('ModelName');`
# Apr 21st 2019, 21:29 challgren My mailer is already tested and mocked but the Integration fails due to wkhtmltopdf exec being missing
# Apr 21st 2019, 21:17 challgren @admad how would you test a controller? Basically my controller calls my custom Mailer which then calls CakePdf to generate a PDF via WkHtmlToPdf however in docker installing WkHtmlToPdf is a huge PITA. So I still want to test the controller but Mock CakePdf->output()
# Apr 21st 2019, 19:17 hollistergraham123 Nvm. Figured it out. Can’t pass an array of table classes. Have to do them one at a time.
# Apr 21st 2019, 19:15 hollistergraham123 Hey, when doing a select the documentation says I can pass the table class to the query to select all fields from that table. But when I pass $this->Tablename in a controller I get an error that says, ‘Can’t convert class to string’. Does anyone know what i’m doing wrong?
# Apr 21st 2019, 12:47 admad You shouldn't me mocking stuff in integration tests
# Apr 21st 2019, 12:09 challgren So I’m doing integration testing via $this->post(‘/url’); and I need to mock up some part of the controller. How would I go about mocking part of the controller
# Apr 20th 2019, 23:05 waspinator when saving belongs-to-many-associations you can either use an array of properties **OR** a list of _ids, but not both right? `both arrays of properties, as well as a list of ids at the _ids key` https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-belongstomany-associations
# Apr 20th 2019, 14:16 waspinator perfect, thanks
# Apr 20th 2019, 02:28 admad Make a table class for it and attached the behaviour. Then specify the class name in belongtomany association using `through` key
# Apr 20th 2019, 01:43 waspinator is there a way of adding the Timestamp behavior into a join table?
# Apr 19th 2019, 21:09 swimboy OK, I've reverted the changes I made to the validator code, moved the locale code from the AppController to the bootstrap and now everything is working. Thanks for your help. (I think my original problem was my bootstrap.php file was old and didn't have the I18n block in it like the one you linked to above. I copied that in and referenced the I18n namespaces at the top.)
# Apr 19th 2019, 21:00 swimboy I was only looking at the validator code to understand what was going on.
# Apr 19th 2019, 20:59 swimboy I understand that I shouldn't muck around in the validator code, I just wanted to set up the date validator once, instead of each table class file.
# Apr 19th 2019, 20:54 admad And stop mucking around with the validator code, just specific the format to use when setting up the validator in your table class
# Apr 19th 2019, 20:52 admad @swimboy you are supposed to enable locale based datetime string parsing here https://github.com/cakephp/app/blob/master/config/bootstrap.php#L181
# Apr 19th 2019, 20:18 swimboy If I change the default in ``function dateTime`` and ``function date`` to ``'mdy'`` it works just fine. Obviously, I don't want to do that in a production setting. Is there a way in my own code to override the behavior of the date and dateTime validators in a single location rather than adding it as a separate parameter everywhere I validate a date in a table?
# Apr 19th 2019, 20:12 swimboy Digging even deeper, I found this line in the Validator.php file: ``` public function dateTime($field, $formats = ['ymd'], $message = null, $when = null)``` which looks to me like the default behavior for date validation is expecting the date in year,month,day order unless another format is specified when the validator is called. It seems to me that this default should pick up the format from setLocaleFormat, should it not?