# |
Dec 15th 2017, 03:15 |
voycey |
Whats a good way of managing cloned forms on a page? |
# |
Dec 15th 2017, 03:14 |
admad |
You should have chosen a better array format then :) |
# |
Dec 15th 2017, 03:13 |
voycey |
it feels like there should be a nice way to do this but not sure haha |
# |
Dec 15th 2017, 03:13 |
voycey |
i mean id need to create an entity from all element 0, then another from all element 1 |
# |
Dec 15th 2017, 03:13 |
admad |
patchEntities() |
# |
Dec 15th 2017, 03:12 |
voycey |
I think Hash::map but it doesnt make sense |
# |
Dec 15th 2017, 03:11 |
admad |
@rafael.junqueira.sant you are supposed to use the flash helper to render the flash messages, not use the flash elements directly. |
# |
Dec 15th 2017, 03:10 |
voycey |
File uploaded https://cakesf.slack.com/files/U1F0J3623/F8F8JHL9K/pasted_image_at_2017_12_15_02_10_pm.png / https://slack-files.com/T053DPNCM-F8F8JHL9K-75400dec9a |
# |
Dec 15th 2017, 00:19 |
braeden |
although probably not very nice... |
# |
Dec 15th 2017, 00:18 |
braeden |
It should be possible by accessing the session |
# |
Dec 14th 2017, 22:30 |
obinoob |
how can I set a flash message from model beforeDelete method? |
# |
Dec 14th 2017, 21:47 |
obinoob |
anyone? |
# |
Dec 14th 2017, 21:45 |
obinoob |
is this the answer to my question? https://book.cakephp.org/3.0/en/controllers/middleware.html |
# |
Dec 14th 2017, 21:43 |
obinoob |
hi, I need separate application logic way from controller ex: before delete user verify if it is "locked" or before give access verify if it has the proper rights etc is there any smart way to do this in cake? |
# |
Dec 14th 2017, 21:37 |
rafael.junqueira.sant |
It might be something I'm missing, but it looks like an issue or an incomplete feature indeed. |
# |
Dec 14th 2017, 21:36 |
rafael.junqueira.sant |
in core flash, is there a way to render only the success or error messages? |
# |
Dec 14th 2017, 21:35 |
rafael.junqueira.sant |
oh, I see |
# |
Dec 14th 2017, 21:34 |
dereuromark |
wait.. that is if you use the flash plugin, it will not work with the core stuff |
# |
Dec 14th 2017, 21:34 |
rafael.junqueira.sant |
That was helpful, let me try. |
# |
Dec 14th 2017, 21:32 |
dereuromark |
Might be. This is how I do it to render in a certain order: https://github.com/dereuromark/cakephp-flash/blob/master/src/View/Helper/FlashHelper.php#L24 but you can also just fetch them separately: https://github.com/dereuromark/cakephp-flash/blob/master/tests/TestCase/View/Helper/FlashHelperTest.php#L89 |
# |
Dec 14th 2017, 21:32 |
rafael.junqueira.sant |
oh, alright. so it may be an issue, right? |
# |
Dec 14th 2017, 21:32 |
dereuromark |
pull request |
# |
Dec 14th 2017, 21:31 |
rafael.junqueira.sant |
what's a core PR? Tried google, no success |
# |
Dec 14th 2017, 21:30 |
dereuromark |
hm probably no test for this, you can try fixing it and making a core PR if you find out whats going on |
# |
Dec 14th 2017, 21:30 |
rafael.junqueira.sant |
I'm researching about TestCases, 1 min |
# |
Dec 14th 2017, 21:28 |
rafael.junqueira.sant |
since the code of flash/error.ctp and flash/success.ctp are almost identical (the only difference is the class of the message container), I assumed there was something behind the scenes happening and giving the variables the right values, but I'm not sure anymore. |
# |
Dec 14th 2017, 21:28 |
dereuromark |
https://github.com/cakephp/cakephp/blob/master/tests/TestCase/View/Helper/FlashHelperTest.php |
# |
Dec 14th 2017, 21:26 |
rafael.junqueira.sant |
what do you mean by test cases? |
# |
Dec 14th 2017, 21:26 |
dereuromark |
do the test cases yield any answers? |
# |
Dec 14th 2017, 21:25 |
rafael.junqueira.sant |
with the slash it actually finds the element, but the variables do not receive the values of the success and error messages |
# |
Dec 14th 2017, 21:24 |
rafael.junqueira.sant |
dot gives an error |
# |
Dec 14th 2017, 21:24 |
rafael.junqueira.sant |
no, slash / |
# |
Dec 14th 2017, 21:24 |
dereuromark |
you mean dot? |
# |
Dec 14th 2017, 21:23 |
rafael.junqueira.sant |
it works with the slash syntax, just tested. |
# |
Dec 14th 2017, 21:22 |
dereuromark |
or you can use the flash plugin which allows you to re-sort via config beforehand. |
# |
Dec 14th 2017, 21:22 |
rafael.junqueira.sant |
I'll try |
# |
Dec 14th 2017, 21:21 |
dereuromark |
or with dot syntax: flash.success etc, check how the code looks for it in the session |
# |
Dec 14th 2017, 21:20 |
dereuromark |
from the code it should probably be only the type, e.g. "success" etc |
# |
Dec 14th 2017, 21:18 |
dereuromark |
where did you get that idea? |
# |
Dec 14th 2017, 21:15 |
slackebot |
$this->element('flash/error'); ?> What I expected to happen was |
# |
Dec 14th 2017, 21:15 |
rafael.junqueira.sant |
This is in my controller: if ($this->Services->save($service)) { $this->Flash->success(__('The service has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The service could not be saved. Please, try again.')); Here is what's in my template: <?= $this->element('flash/success'); ?> <?= |