# |
May 7th 2021, 12:01 |
neon1024 |
The test does build a Request object to inject into the controller which is what made me wonder |
# |
May 7th 2021, 12:00 |
neon1024 |
Does the routing rely on the request beyond just mapping to a controller? I have a unit test which throws a missing route, when it works fine in my application |
# |
May 7th 2021, 11:37 |
slackebot |
'node_modules/packery/dist/packery.pkgd.min.js', 'node_modules/select2/dist/js/select2.js', 'node_modules/toastify-js/src/toastify.js', 'node_modules/sweetalert2/dist/sweetalert2.js', ... you custom js modules ... ], base: 'source/js', filename: 'main.js', dest: "./webroot/js"``` And in your templates/layout/default.php you just include the generated main.js `*<?=* $this->Html->script( 'main.js' ) *?>*` |
# |
May 7th 2021, 11:37 |
kevin.pfeifer |
so like this ```src: [ // NODE MODULES 'node_modules/jquery/dist/jquery.min.js', 'node_modules/jquery-ui-dist/jquery-ui.min.js', 'node_modules/flatpickr/dist/flatpickr.js', 'node_modules/flatpickr/dist/l10n/de.js ', 'node_modules/datatables.net/js/jquery.dataTables.min.js', 'node_modules/datatables.net-dt/js/dataTables.dataTables.min.js', 'node_modules/moment/min/moment-with-locales.js', |
# |
May 7th 2021, 11:33 |
kevin.pfeifer |
and let gulp concat and minify them for you inside your desired `webroot/assets/js` or wherever path |
# |
May 7th 2021, 11:33 |
kevin.pfeifer |
basically you "just" need to intall each JS library with `npm install my-desired-library` then check inside the node_modules/my-desired-library/ folder which file(s) you actually need inside your application |
# |
May 7th 2021, 11:31 |
kevin.pfeifer |
if so checkout https://www.devguide.at/en/node-js/gulp/gulp-example-for-scss-js-and-browsersync/ |
# |
May 7th 2021, 11:31 |
kevin.pfeifer |
are you familiar with gulp? |
# |
May 7th 2021, 10:57 |
neon1024 |
Otherwise you can implement a json template and serve whatever json you want from there |
# |
May 7th 2021, 10:57 |
neon1024 |
You might be missing a serialize in your Controller if you’re expecting the controller to return json |
# |
May 7th 2021, 10:44 |
rightscoreanalysis |
my request header is *X-Requested-With:* XMLHttpRequest |
# |
May 7th 2021, 10:44 |
rightscoreanalysis |
from the book "By default RequestHandler will automatically detect AJAX requests based on the `X-Requested-With` HTTP header" |
# |
May 7th 2021, 10:44 |
rightscoreanalysis |
in my routes I havbe: $builder->setExtensions(['json', 'xml', 'ajax']); |
# |
May 7th 2021, 10:43 |
rightscoreanalysis |
when I am making an AJAX request Cake is complaining that it can't find the view |
# |
May 7th 2021, 10:27 |
neon1024 |
Although I am on a 4.0.10 release of Cake, so perhaps a newer version of Cake would bring a newer version of DebugKit :thinking_face: |
# |
May 7th 2021, 10:26 |
neon1024 |
How do I see `getRequest()->getAttribute()` data in Debug Kit? The Request tab doesn’t seem to show the request attributes |
# |
May 7th 2021, 10:05 |
rightscoreanalysis |
thx |
# |
May 7th 2021, 10:04 |
neon1024 |
@rightscoreanalysis Are you looking for Bulk Update maybe? https://book.cakephp.org/4/en/orm/saving-data.html#bulk-updates |
# |
May 7th 2021, 09:51 |
rightscoreanalysis |
if so how can I patch the entity, as it will be patching iteself? |
# |
May 7th 2021, 09:50 |
rightscoreanalysis |
is this the right way to go? I want to do a single save rather than per record/row |
# |
May 7th 2021, 09:50 |
rightscoreanalysis |
I want to update a field in every record of my table, I am doing a find all, then looping the results and updating the field |
# |
May 7th 2021, 08:33 |
erwane |
@kevin.pfeifer do you have a doc about using npm packages in (cake)php project please ? |
# |
May 6th 2021, 20:16 |
scsmith |
@admad prefect. thank you. |
# |
May 6th 2021, 20:13 |
admad |
@scsmith `$this->getController()->loadModel()` will give you the default model instance. |
# |
May 6th 2021, 19:29 |
greg138 |
How was it getting that, and what error do you get when you try it now? |
# |
May 6th 2021, 19:15 |
scsmith |
In CakePHP 3.x we had a component that access the controllers primary model through the modelClass. In CakePHP 4.x is there another way to get this information? |
# |
May 6th 2021, 16:08 |
neon1024 |
Ah well, it can be tomorrows problem :wave: |
# |
May 6th 2021, 16:06 |
neon1024 |
Just some really odd test case issues. Like if you use the `IntergrationTestTrait`, use `configRequest` in your `setUp` and call `enableCsrfToken` then `post()`, you get an error because the cookie isn’t set. When `enableCsrfToken` docblock says it sets the cookie. I suppose it can set it and not send it :thinking_face: |
# |
May 6th 2021, 16:00 |
neon1024 |
Thankfully a bit of regex and search and replace have got me most of the way so far |
# |
May 6th 2021, 15:59 |
neon1024 |
I sure hope it works! I have gone up to 4.0.10, so have the 4.1 and 4.2 upgrades still on the horizon |
# |
May 6th 2021, 15:55 |
ndm |
Could be for the better, trying to get rector to work was a pain everytime I tried it, that thing seems to break like clockwork, at least for me :upside_down_face: |
# |
May 6th 2021, 15:51 |
neon1024 |
I had some issues with the upgrade tool crashing for Symfony Console ProgressBar class, so couldn’t get through all the automation :( |
# |
May 6th 2021, 15:51 |
neon1024 |
This is probably an edge-case as I am upgrading from Cake 3.9 :) |
# |
May 6th 2021, 15:50 |
ndm |
Ah, guess that only happens when the token is wrong... |
# |
May 6th 2021, 15:50 |
ndm |
Looking at the source, it doesn't seem that debug tokens are supported... not sure what to make of that. https://github.com/cakephp/cakephp/blob/master/src/TestSuite/IntegrationTestTrait.php#L652 |
# |
May 6th 2021, 15:50 |
neon1024 |
Seems it’s a session issue :) |
# |
May 6th 2021, 15:49 |
neon1024 |
// Fixate sessionid early on, as php7.2+ // does not allow the sessionid to be set after stdout // has been written to. session_id(‘cli’); |
# |
May 6th 2021, 15:46 |
neon1024 |
I see it here also https://book.cakephp.org/4/en/development/testing.html#testing-actions-protected-by-csrfcomponent-or-securitycomponent |
# |
May 6th 2021, 15:45 |
erwane |
opened an issue : https://github.com/composer/installers/issues/488 I don't found any solution for composer 2 parallel install and version check. |
# |
May 6th 2021, 15:40 |
neon1024 |
Anyone know why I see `Invalid security debug token` in my unit test when I am calling `$this->enableSecurityToken();` specifically for this? |
# |
May 6th 2021, 14:48 |
neon1024 |
THen if it’s null, it says it needs to be called, rather than telling you to load it |