# |
Apr 23rd 2019, 07:50 |
conehead |
Good mornin |
# |
Apr 23rd 2019, 07:43 |
neon1024 |
Morning all |
# |
Apr 22nd 2019, 22:53 |
phantomwatson |
I'm trying to port a CakePHP 3 site to 4 and running into a weird problem where the `HTTPS` env variable isn't being set, even when the request is using the HTTPS protocol, resulting in `request->is('ssl')` incorrectly returning `false`. In the CakePHP 3 version of this site, `$_SERVER['HTTPS']` is being set to `'on'`, but it's not being set at all in CakePHP 4. I'm having trouble figuring out what's causing this. |
# |
Apr 22nd 2019, 22:12 |
lorenzo |
@phantomwatson was objecting to what @sdevore suggested |
# |
Apr 22nd 2019, 20:28 |
phantomwatson |
I'm not sure which point you're objecting to. I'm not planning to load environment variables from a file in production. |
# |
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. |