# |
Nov 30th 2017, 15:46 |
unclezoot |
last attempt: https://www.pastiebin.com/5a2027c8655db |
# |
Nov 30th 2017, 15:44 |
unclezoot |
i.e. WHERE (A AND B) OR (C AND D) |
# |
Nov 30th 2017, 15:44 |
unclezoot |
could anyone give me some pointers on the cake ORM, specifically how to generate this WHERE condition: WHERE (publish_from <= CURRENT_DATE AND publish_to >= CURRENT_DATE) OR (publish_from is NULL AND publish_to IS NULL) |
# |
Nov 30th 2017, 15:43 |
h.mavisakalian |
“Warning (4096): Object of class Cake\View\Helper\FormHelper could not be converted to string” |
# |
Nov 30th 2017, 15:42 |
h.mavisakalian |
but works |
# |
Nov 30th 2017, 15:42 |
h.mavisakalian |
still gives that warning |
# |
Nov 30th 2017, 15:42 |
h.mavisakalian |
I did |
# |
Nov 30th 2017, 15:38 |
casmo |
test |
# |
Nov 30th 2017, 15:32 |
casmo |
And even better solutions than mine |
# |
Nov 30th 2017, 15:32 |
casmo |
Here is more info about the Form templates: https://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses |
# |
Nov 30th 2017, 15:31 |
h.mavisakalian |
@casmo s solution |
# |
Nov 30th 2017, 15:31 |
kaliel |
what worked ? |
# |
Nov 30th 2017, 15:30 |
h.mavisakalian |
Object of class Cake\View\Helper\FormHelper could not be converted to string |
# |
Nov 30th 2017, 15:30 |
h.mavisakalian |
but I get a warning |
# |
Nov 30th 2017, 15:30 |
h.mavisakalian |
it worked |
# |
Nov 30th 2017, 15:28 |
casmo |
$this->Form->setTemplates(['inputContainer' => '{{content}}']); for example |
# |
Nov 30th 2017, 15:28 |
casmo |
Mavisakalian, this is done through templates |
# |
Nov 30th 2017, 15:28 |
kaliel |
$this->Form->input() |
# |
Nov 30th 2017, 15:27 |
kaliel |
change method from control() to input() |
# |
Nov 30th 2017, 15:26 |
h.mavisakalian |
div => false - doesn’t work |
# |
Nov 30th 2017, 15:26 |
h.mavisakalian |
Can anyone tell me how to remove the input wrap in the latest version ( 3.5 ) |
# |
Nov 30th 2017, 15:16 |
kaliel |
you mean production app ? |
# |
Nov 30th 2017, 15:15 |
hmic |
i'd not put stuff thats not my app into src |
# |
Nov 30th 2017, 15:14 |
kaliel |
@hmic, yes this is what i do, but i like to have different thoughts |
# |
Nov 30th 2017, 15:14 |
hmic |
kaliel: why not create a dir for them? |
# |
Nov 30th 2017, 15:13 |
kaliel |
is /src a good choice ? |
# |
Nov 30th 2017, 15:13 |
kaliel |
hey guys, i'd like to know where's the best place / the place you use, to store frontend dev files (scss, es6, etc..) in a cake project ? |
# |
Nov 30th 2017, 15:01 |
neon1024 |
Sure you can, but you’ll need to manually marshal them |
# |
Nov 30th 2017, 14:59 |
obinoob |
neon1024 hold on, so i can't have inputs named like: name, address, district_id, town_id ?? |
# |
Nov 30th 2017, 14:52 |
AlexMax |
Question - is there some easy way to hydrate the invisible 'rowid' row when using sqlite3? |
# |
Nov 30th 2017, 14:50 |
neon1024 |
Do bear in mind that singular associations will be automatically marshalled only if the form name is singular as well, so the array matches the entity properties |
# |
Nov 30th 2017, 14:49 |
neon1024 |
As you’d be expecting `$this->Form->control('addresses.0.street')` etc |
# |
Nov 30th 2017, 14:49 |
neon1024 |
Then either you have a bug, most likely you’ve not repeated the ‘associated’ key in the array. Or your request data array isn’t correct, which would be down to bad form naming |
# |
Nov 30th 2017, 14:47 |
obinoob |
neon1024 I've taken from here https://book.cakephp.org/3.0/en/orm/saving-data.html#converting-request-data-into-entities |
# |
Nov 30th 2017, 14:46 |
obinoob |
neon1024 actually I have done before you pointed that still the entity doesn't get filled https://gist.github.com/obinoob/8d833962e3a167143b38a5f5697209c9 |
# |
Nov 30th 2017, 14:35 |
neon1024 |
Then as @admad suggested, `var_dump()` the resulting entity to ensure that you have nested entities :slightly_smiling_face: |
# |
Nov 30th 2017, 14:33 |
neon1024 |
Or you can use dot notation if that’s your flavour |
# |
Nov 30th 2017, 14:33 |
neon1024 |
Then you might want to declare them in your patchEntity, as `->patchEntity($entity, $this->request->getData(), ['associated' => ['Addresses' => ['associated' => ['Disctricts', 'Towns']]]])` |
# |
Nov 30th 2017, 14:32 |
obinoob |
neon1024 yes I believe so, see clients -> addresses -> [districts, towns] |
# |
Nov 30th 2017, 14:21 |
admad |
to debug first ensure you have entities for the hasmany records after patching and not arrays |
# |
Nov 30th 2017, 14:20 |
neon1024 |
obinoob, Are the associations more than 1 table deep? |