# |
Feb 14th 2018, 16:33 |
fvanhest |
Hi Guys, Where do I place plugin specific bake templates? <plugin>/src/Template/Bake doesn’t seem to work. |
# |
Feb 14th 2018, 16:07 |
neon1024 |
I use the same technique as @dereuromark and assign the request data to a variable and use that :slightly_smiling_face: |
# |
Feb 14th 2018, 16:07 |
neon1024 |
Yes, it implements the interface, and the interface defines that it should be treated as immutable. So perhaps not strictly, but best treated as so |
# |
Feb 14th 2018, 16:05 |
neon1024 |
I’m pretty certain that Cake implements PSR7 which makes requests immutable |
# |
Feb 14th 2018, 16:03 |
neon1024 |
Lol, discussing minute details |
# |
Feb 14th 2018, 15:26 |
dereuromark |
which is the obvious expectation for a bool representation of empty |
# |
Feb 14th 2018, 15:26 |
dereuromark |
"Impossible to sent bool/null value" We are talking about cakephp here. The formhelper of course transformes bool true to empty string in the select. |
# |
Feb 14th 2018, 15:15 |
saeideng |
dereeromark plugin |
# |
Feb 14th 2018, 15:15 |
saeideng |
or use shim plugin |
# |
Feb 14th 2018, 15:15 |
hmic |
exactly, net the marshaller deal with it |
# |
Feb 14th 2018, 15:14 |
saeideng |
convert it to null in marshal time |
# |
Feb 14th 2018, 15:14 |
pidlo |
success it takes effect:) |
# |
Feb 14th 2018, 15:14 |
hmic |
empty() is true for '' *and* 0, which is bad |
# |
Feb 14th 2018, 15:14 |
hmic |
but you need to convert it afterwards |
# |
Feb 14th 2018, 15:14 |
hmic |
and even '' to get tristate (null) |
# |
Feb 14th 2018, 15:14 |
pidlo |
if (empty($this->request->data['department'])){$item->department = null;} |
# |
Feb 14th 2018, 15:14 |
hmic |
you can send 0 and 1 |
# |
Feb 14th 2018, 15:14 |
saeideng |
you have '' |
# |
Feb 14th 2018, 15:13 |
saeideng |
in fact impossible to sent bool value to server from html form |
# |
Feb 14th 2018, 15:11 |
saeideng |
from form ? |
# |
Feb 14th 2018, 15:09 |
pidlo |
:( i cannot save (update) NULL value in any examples...:( |
# |
Feb 14th 2018, 15:01 |
birdy247 |
@dereuromark wins |
# |
Feb 14th 2018, 14:59 |
dereuromark |
I always use bool value :slightly_smiling_face: |
# |
Feb 14th 2018, 14:59 |
saeideng |
dereoromark empty => `''` IMO |
# |
Feb 14th 2018, 14:57 |
dereuromark |
saeding: but also not future proof :slightly_smiling_face: |
# |
Feb 14th 2018, 14:57 |
dereuromark |
birty: empty=>true ? |
# |
Feb 14th 2018, 14:57 |
saeideng |
`$this->request->data['department'] ` is not immutable |
# |
Feb 14th 2018, 14:56 |
birdy247 |
Is it possible to use the Form helper date input and have a blank date? |
# |
Feb 14th 2018, 14:56 |
saeideng |
neon `request` is not immutable |
# |
Feb 14th 2018, 14:55 |
dereuromark |
you can $data = $this->request->getData(); $data[...] = .. and then use $data in patchEntity() |
# |
Feb 14th 2018, 14:52 |
pidlo |
after this or before? |
# |
Feb 14th 2018, 14:52 |
pidlo |
$item = $this->Model->patchEntity($item, $this->request->getData()) |
# |
Feb 14th 2018, 14:51 |
pidlo |
$this->Model->patchEntity($item, $this->request->getData()) |
# |
Feb 14th 2018, 14:51 |
pidlo |
Yes it is but can help me where can i write this? |
# |
Feb 14th 2018, 14:49 |
hmic |
this looks more like 2.x syntax, doesnt it? |
# |
Feb 14th 2018, 14:49 |
neon1024 |
`$request = $this->request->withData('department', null)` |
# |
Feb 14th 2018, 14:48 |
neon1024 |
Yes, requests are immutable. Meaning you need to assign data to them using a method, and assigning the return |
# |
Feb 14th 2018, 14:47 |
pidlo |
this has no effect and field has previous value |
# |
Feb 14th 2018, 14:47 |
pidlo |
$this->request->data['department'] =null |
# |
Feb 14th 2018, 14:47 |
pidlo |
hello all how can i set NULL value with update? |
# |
Feb 14th 2018, 14:02 |
hmic |
or even headers? |