# |
Feb 7th 2018, 14:03 |
alysson-azevedo |
and after that, checkout documentation about this _serialize thing |
# |
Feb 7th 2018, 14:02 |
alysson-azevedo |
yes. try set $this->set('_serialize', true); on your beforeRender function |
# |
Feb 7th 2018, 14:00 |
eax |
admad: because it's empty? |
# |
Feb 7th 2018, 13:59 |
admad |
https://gist.github.com/eaxexe/b81d57a63dc1727eb78347c6b5f95daa#file-allaction-php-L30 that's why |
# |
Feb 7th 2018, 13:58 |
eax |
And the final output, doesn't have anything in 'data' (even if I set data in $subject) |
# |
Feb 7th 2018, 13:57 |
eax |
I think I forgot an important fact: I am using the ApiListener to output to JSON :) |
# |
Feb 7th 2018, 13:57 |
eax |
alysson-azevedo: Indeed it is! |
# |
Feb 7th 2018, 13:56 |
alysson-azevedo |
yep. your data probably is on $subject->entities |
# |
Feb 7th 2018, 13:55 |
admad |
crud actions are supposed to render page or do something and redirect like normal action, not return data :slightly_smiling_face: |
# |
Feb 7th 2018, 13:55 |
alysson-azevedo |
you mean on your beforeRender callback, the $subject variable is null? |
# |
Feb 7th 2018, 13:53 |
eax |
Can someone tell me why my Custom Action in CRUD (Cake3) : https://gist.github.com/eaxexe/b81d57a63dc1727eb78347c6b5f95daa, doesn't return any data? :) Thanks! |
# |
Feb 7th 2018, 13:52 |
alysson-azevedo |
I wonder if there's a way to configure his plugin to use another Excel writer |
# |
Feb 7th 2018, 13:51 |
alysson-azevedo |
on that note, "my" plugin is basically a copy of https://github.com/dakota/CakeExcel, but using mk-j/PHP_XLSXWriter instead that PHPOffice/PHPExcel |
# |
Feb 7th 2018, 13:49 |
alysson-azevedo |
i see. thanks |
# |
Feb 7th 2018, 13:48 |
admad |
otherwise having /plugins/myPlugin/composer.json is useless. Add those deps directly to app's composer.json |
# |
Feb 7th 2018, 13:47 |
admad |
your plugin needs to be submitted to packagist and added as dependency to app through `composer require` only then it's dependencies would also be installed |
# |
Feb 7th 2018, 13:22 |
alysson-azevedo |
do i need to run composer install from my plugin dir? |
# |
Feb 7th 2018, 13:21 |
alysson-azevedo |
Hi guys, when i run `composer update` from my project's root dir, why it doesn't install the dependences declared on my /plugins/myPlugin/composer.json? |
# |
Feb 7th 2018, 13:19 |
ksc |
Okay thanks alot! |
# |
Feb 7th 2018, 13:14 |
eax |
* Which means I now actually get a response, but no data :P |
# |
Feb 7th 2018, 13:14 |
slackebot |
Action: eax Turns out I was missing a: $this->_trigger('beforeRender', $subject); ! Which means I now actually |
# |
Feb 7th 2018, 12:53 |
eax |
Hey Folks - I am trying to make a custom action in CRUD in Cake3, but when I run it, all I get back is 'null'. Here's my code: https://gist.github.com/eaxexe/b81d57a63dc1727eb78347c6b5f95daa - Can anyone see anything wrong? Or know other reasons why it simply returns null? _get is run correctly, and if I check the $entities variable before it returns, it returns correct data |
# |
Feb 7th 2018, 12:49 |
steinkel |
pass the user role to a custom finder in options and let the model handle the business logic |
# |
Feb 7th 2018, 12:48 |
steinkel |
different functions seem like too much for me |
# |
Feb 7th 2018, 12:48 |
ksc |
*custom finders in the table |
# |
Feb 7th 2018, 12:47 |
ksc |
Mhh, Okay. So i think i have 2 options: i could create custom finders in the Controller and check in the index function if its a user, admin, guide, etc. and call the custom finder. And i have to authorize all roles to call the function. Or i could create different function depending on the roles, e.g. guide_index, admin_index, user_index... ? Could you tell me what is best practice with cake? |
# |
Feb 7th 2018, 12:41 |
steinkel |
and it won't affect the contents of the query you use to display the paginated results in index |
# |
Feb 7th 2018, 12:41 |
steinkel |
the allowed callback is used to check for authorization |
# |
Feb 7th 2018, 12:41 |
steinkel |
in that case it would be a custom finder in your table class to filter by the user logged in |
# |
Feb 7th 2018, 12:40 |
o0h |
Hi. I read source of Datasource, found `ConnectionInterface` is annotated with `@method lastInsertId()`. To create `Connection` class, should I implements the method? But, `Cake\Datasource\Connection` has not lastInsertId(). I feel it’s better that the method is implemented in `Driver` layer as delegating to DBO/PDO instance. |
# |
Feb 7th 2018, 12:38 |
ksc |
Well, could i ask just one more question? Do you have any reference to simplerbac allowed functions for the index function of controllers? i just want to display just my own orders. For view, edit, delete it is clear: https://gist.github.com/anonymous/bc35bd95764a21ab990ca12fe0cb4659 |
# |
Feb 7th 2018, 12:33 |
neon1024 |
I’ve gone with an updateAll in the delete() method already, but an on delete is a good shout |
# |
Feb 7th 2018, 12:33 |
neon1024 |
I didn’t know you had a new one until I linked the repo |
# |
Feb 7th 2018, 12:23 |
ksc |
Ahhh well, i think i got it. Thank you very much! |
# |
Feb 7th 2018, 12:15 |
admad |
@neon1024 for your question: just use "on delete set" for the foreign key in db. |
# |
Feb 7th 2018, 12:10 |
admad |
@neon1024 please recommend my new social auth plugin instead of hybridauth one to people |
# |
Feb 7th 2018, 12:09 |
admad |
@rochasmarcelo https://github.com/ADmad/cakephp-social-auth |
# |
Feb 7th 2018, 12:03 |
rochasmarcelo |
@cleptric thanks |
# |
Feb 7th 2018, 11:59 |
cleptric |
@rochasmarcelo https://github.com/cakephp/authentication/blob/master/docs/Authenticators.md#oauth |
# |
Feb 7th 2018, 11:38 |
steinkel |
https://github.com/CakeDC/users/blob/master/Docs/Documentation/Extending-the-Plugin.md |
# |
Feb 7th 2018, 11:38 |
steinkel |
yes, use $this->UserExtensions as this would be the reference to your Table class |