# |
Feb 7th 2018, 07:40 |
Asphi |
hi! i'm working with FriendsOfCake Crud plugin |
# |
Feb 7th 2018, 06:36 |
isemantics |
while waiting on answer, my current thinking is that I should do this in beforeMarshal, instead of beforeFind |
# |
Feb 7th 2018, 06:29 |
isemantics |
by "non-translated 'name' field", I mean the field 'name' that is on the database table 'collections' (as opposed to the _i18n table) |
# |
Feb 7th 2018, 06:27 |
isemantics |
translated content. After moving the code from Collections::beforeFilter to the controller itself, just before calling Collections->save(), does save the translations, so I assume that I'm correct about the "why". I got it working, but still would like to do it "nicely" in the beforeSave of the model, instead of before all places where Collections->save() is called. Might I still be doing it wrong? is this to be expected? |
# |
Feb 7th 2018, 06:27 |
isemantics |
that translation (in beforesave). At the end I checked the data on the $entity that would be saved ( at the end of beforeFilter ) and looks good, but it does not save the translated version. Thinking about the possible event flow, I realised it might be because TranslateBehavior::beforeSave is executed before the normal Cake beforeSave in the table and maybe does some magic that prevents the normal beforeSave to update/save the |
# |
Feb 7th 2018, 06:27 |
isemantics |
Hi guys. I have a "CollectionsTable" (and Collection entity class) set up with TranslateBehavior in CakePHP3.5 . After someone changes the 'name' field, I want to auto save a slug of the name in the 'friendly_url' field. I tried doing this via CollectionsTable::beforeFilter(...) and that works fine for the non-translated 'name' field, but not for the translations. I loop over the translations, change the friendly_url field for |
# |
Feb 7th 2018, 06:27 |
saeideng |
https://github.com/cakephp/debug_kit/tree/master/config |
# |
Feb 7th 2018, 06:27 |
itamer |
thanks @saeideng! |
# |
Feb 7th 2018, 06:26 |
saeideng |
yes |
# |
Feb 7th 2018, 06:25 |
itamer |
can a plugin have it's own \config\app_form.php file? |
# |
Feb 7th 2018, 04:08 |
FullmetalChocobo |
Quick question about migrations. Should migrations be used to input data into the database? |
# |
Feb 6th 2018, 23:25 |
saeideng |
looks this just used by requestAction() |
# |
Feb 6th 2018, 23:25 |
saeideng |
can i disable for all app? |
# |
Feb 6th 2018, 23:24 |
saeideng |
is this safe ? |
# |
Feb 6th 2018, 23:23 |
saeideng |
$this->loadComponent('RequestHandler', ['enableBeforeRedirect' => false]); |
# |
Feb 6th 2018, 23:02 |
saeideng |
even without `Y/json/index.ctp` |
# |
Feb 6th 2018, 23:01 |
saeideng |
now that works by `return` |
# |
Feb 6th 2018, 22:53 |
saeideng |
but now I want to use without `return` |
# |
Feb 6th 2018, 22:53 |
saeideng |
I will search for reason |
# |
Feb 6th 2018, 22:50 |
saeideng |
no need to PR :D |
# |
Feb 6th 2018, 22:50 |
saeideng |
`_name works for me (without `return` ) |
# |
Feb 6th 2018, 22:49 |
dereuromark |
sure |
# |
Feb 6th 2018, 22:48 |
saeideng |
https://github.com/dereuromark/cakephp-sandbox/tree/3.0/plugins/Sandbox |
# |
Feb 6th 2018, 22:48 |
saeideng |
do you use middleware for this example ? |
# |
Feb 6th 2018, 22:46 |
dereuromark |
feel free to PR sth |
# |
Feb 6th 2018, 22:46 |
dereuromark |
i never used that |
# |
Feb 6th 2018, 22:44 |
saeideng |
all errors are for me , not for your sandbox :) |
# |
Feb 6th 2018, 22:43 |
saeideng |
`$this->redirect(['_name' => 'z']);` / `return $this->redirect(['_name' => 'z']);` |
# |
Feb 6th 2018, 22:43 |
saeideng |
can you put en example with `_name` to your sandbox ? |
# |
Feb 6th 2018, 22:39 |
saeideng |
:face_with_raised_eyebrow: |
# |
Feb 6th 2018, 22:37 |
dereuromark |
should always return. indicates sth with middleware approach and how dispatching might work? |
# |
Feb 6th 2018, 22:36 |
saeideng |
:@ |
# |
Feb 6th 2018, 22:36 |
saeideng |
why that works for you and sandbox ? :| |
# |
Feb 6th 2018, 22:35 |
saeideng |
`$this->redirect(..` works ( without `return`) |
# |
Feb 6th 2018, 22:35 |
saeideng |
for me redirect with `return` not works |
# |
Feb 6th 2018, 22:34 |
saeideng |
https://github.com/dereuromark/cakephp-sandbox/blob/3.0/plugins/Sandbox/src/Controller/AjaxExamplesController.php#L211 |
# |
Feb 6th 2018, 22:34 |
dereuromark |
something worth documenting? |
# |
Feb 6th 2018, 22:33 |
saeideng |
;P |
# |
Feb 6th 2018, 22:33 |
saeideng |
stupid error |
# |
Feb 6th 2018, 22:31 |
saeideng |
i found |
# |
Feb 6th 2018, 22:24 |
saeideng |
``` $this->loadComponent('RequestHandler'); $action=$this->request->getParam('action'); if(in_array($action,['payment'])){ $this->loadComponent('Ajax.Ajax',[ 'flashKey' => 'Flash.payment']); } ``` |