# |
May 7th 2021, 15:40 |
neon1024 |
Anyone know how to use `max()` doesn’t seem to exist in the actual code |
# |
May 7th 2021, 13:55 |
kailas |
anyway, works now |
# |
May 7th 2021, 13:55 |
kailas |
@neon1024 ugh, i could have sworn i did just this before and it didn’t work… |
# |
May 7th 2021, 13:46 |
kevin.pfeifer |
reasons is explained here https://github.com/cakephp/cakephp/pull/14912 |
# |
May 7th 2021, 13:45 |
kevin.pfeifer |
ah but here https://github.com/cakephp/cakephp/blob/master/src/ORM/Behavior.php#L189 |
# |
May 7th 2021, 13:45 |
kevin.pfeifer |
I don't see any deprecation warnings here :thinking_face: https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L386 |
# |
May 7th 2021, 13:43 |
greg138 |
Contrary to how most other classes have gone, the base class says that `getTable` is deprecated, and `table` is preferred. |
# |
May 7th 2021, 13:23 |
neon1024 |
I can see that the Timestamp behaviour uses `$this->table()` https://github.com/cakephp/cakephp/blob/master/src/ORM/Behavior/TimestampBehavior.php#L214 |
# |
May 7th 2021, 13:20 |
kailas |
i tried |
# |
May 7th 2021, 13:20 |
kailas |
weird |
# |
May 7th 2021, 13:18 |
neon1024 |
I mean I use `$this->getTable()` |
# |
May 7th 2021, 13:18 |
kailas |
@neon1024 |
# |
May 7th 2021, 13:17 |
kailas |
nice. any pointers how? i’m having trouble figuring out how to access the table object that the behavior has been instantiated <?> in |
# |
May 7th 2021, 13:10 |
neon1024 |
Yep |
# |
May 7th 2021, 13:06 |
kailas |
I’ve created a behavior. To fully use it, i need to create a belongsTo association for any table that uses the behavior. i’d like for the behavior to add that association. is it possible to do that in the initialize function of the behavior? |
# |
May 7th 2021, 12:53 |
neon1024 |
Thanks again @ndm solved by just loading the routes! :thumbsup: |
# |
May 7th 2021, 12:48 |
neon1024 |
Ah well |
# |
May 7th 2021, 12:48 |
neon1024 |
Works in 3.9 too |
# |
May 7th 2021, 12:47 |
neon1024 |
The routes are there in the controller if I dump them |
# |
May 7th 2021, 12:47 |
neon1024 |
I was just testing the component |
# |
May 7th 2021, 12:26 |
ndm |
Routes will not load themselves in regular tests. Why don't you use integration tests? :worried: |
# |
May 7th 2021, 12:19 |
neon1024 |
Here is what the test looks like if anyone has any ideas why the routing wouldn’t work just in this test-case |
# |
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? |