# |
Aug 22nd 2019, 11:52 |
neon1024 |
I’m hardly the worlds greatest idiot and I couldn’t work it out |
# |
Aug 22nd 2019, 11:51 |
neon1024 |
..and it shows there is an opportunity to improve the documentation |
# |
Aug 22nd 2019, 11:51 |
neon1024 |
Yep, that’s me |
# |
Aug 22nd 2019, 11:51 |
admad |
but if someone is dumb enough to add the middleware in application and for specific route too then there would be |
# |
Aug 22nd 2019, 11:50 |
alexdd55976 |
middlewhere... everyware |
# |
Aug 22nd 2019, 11:50 |
alexdd55976 |
middlewares.... everywhere... |
# |
Aug 22nd 2019, 11:50 |
admad |
there aren't |
# |
Aug 22nd 2019, 11:50 |
neon1024 |
:exploding_head: |
# |
Aug 22nd 2019, 11:50 |
neon1024 |
..and a component! |
# |
Aug 22nd 2019, 11:50 |
neon1024 |
There are *two* csrf middlwares?! :S |
# |
Aug 22nd 2019, 11:49 |
admad |
well if you have the csrfmiddleware in your application too obviously that wont wokr |
# |
Aug 22nd 2019, 11:49 |
neon1024 |
That should be a heading imho |
# |
Aug 22nd 2019, 11:49 |
neon1024 |
Yeah, there is a tiny grey comment line |
# |
Aug 22nd 2019, 11:48 |
neon1024 |
Maybe it should be in `Application.php`, I’m not sure |
# |
Aug 22nd 2019, 11:48 |
neon1024 |
@admad The only thing I can see, I added it to `routes.php` as the above example is talking about scoped middleware in routes |
# |
Aug 22nd 2019, 11:47 |
neon1024 |
@admad https://book.cakephp.org/3.0/en/controllers/middleware.html#cross-site-request-forgery-csrf-middleware :point_right: and scroll down to the code example for `whitelistCallback` |
# |
Aug 22nd 2019, 11:47 |
alexdd55976 |
did you check for a simple type? |
# |
Aug 22nd 2019, 11:47 |
neon1024 |
@alexdd55976 Perhaps I need to make associated id fields accessible :thinking_face: |
# |
Aug 22nd 2019, 11:47 |
admad |
link me |
# |
Aug 22nd 2019, 11:46 |
neon1024 |
@admad The example given in the book :slightly_smiling_face: I copied it and it didn’t work |
# |
Aug 22nd 2019, 11:46 |
admad |
@neon1024 "Lol, even the whitelist callback doesn’t work" what does not work? |
# |
Aug 22nd 2019, 11:46 |
neon1024 |
I am submitting id fields with my existing records, and the resulting entities are marked new and the id field is missing |
# |
Aug 22nd 2019, 11:46 |
alexdd55976 |
yes |
# |
Aug 22nd 2019, 11:46 |
neon1024 |
The result ends up with `public '[new]' => boolean true` in the entity |
# |
Aug 22nd 2019, 11:46 |
alexdd55976 |
oh, yes |
# |
Aug 22nd 2019, 11:45 |
neon1024 |
Well you know that when patchEntity runs, it determines if an entity is new or not by if the id field is present |
# |
Aug 22nd 2019, 11:45 |
alexdd55976 |
@neon1024 i am not getting the whole thing (maybe i read it worng) |
# |
Aug 22nd 2019, 11:43 |
neon1024 |
Anyone have any idea why, when I submit request data array it includes id field, but when the entities are created, they’re marked as new |
# |
Aug 22nd 2019, 11:37 |
admad |
@rchavik if $this->request->getQuery() is empty that problem has nothing to do with crud or search plugin |
# |
Aug 22nd 2019, 11:36 |
neon1024 |
@rhc |
# |
Aug 22nd 2019, 11:33 |
rchavik |
hi, trying to get crud + seach working, but somehow even though requset contains `[REQUEST_URI] => /api/nodes?q=hello`, $this->request->getQuery() in controller is empty. any idea what i'm missing? |
# |
Aug 22nd 2019, 11:33 |
alexdd55976 |
useful, would only use for excessive usage... othewise it might be a bit over the top |
# |
Aug 22nd 2019, 11:32 |
conehead |
Looks promising as well. Thank you |
# |
Aug 22nd 2019, 11:27 |
challgren |
I did use https://github.com/ypnos-web/cakephp-datatables a while ago |
# |
Aug 22nd 2019, 11:26 |
conehead |
@admad @alexdd55976 good gosh. Thanks I guess this solves my problem totally. Not sure why I thought I HAD to use paginator |
# |
Aug 22nd 2019, 11:25 |
slackebot2 |
'%s.salesTotal/%s.salesQuantity', $alias, $alias )), ]); ``` |
# |
Aug 22nd 2019, 11:25 |
mehov |
https://cakesf.slack.com/archives/C053DPNGT/p1566461092003200 Nope, still getting `Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Table.salesTotal' in 'field list'`. Here's what I did: ``` $alias = $query->getRepository()->getAlias(); $query->select([ 'salesTotal' => $query->func()->sum('Table.total'), 'salesQuantity' => $query->func()->sum('Table.quantity'), 'calcPrice' => $query->newExpr(sprintf( |
# |
Aug 22nd 2019, 11:25 |
alexdd55976 |
just replace and remove stuff you don't need and you are good to go |
# |
Aug 22nd 2019, 11:25 |
alexdd55976 |
@conehead here is my code i used to create datatable conform stuff... incl search field |
# |
Aug 22nd 2019, 11:23 |
admad |
@conehead if you don't want the count just dont use paginator, set "limit" and "offset" yourself to teh query |
# |
Aug 22nd 2019, 11:22 |
conehead |
This could be exactly what I am looking for |