# |
Jul 2nd 2017, 03:41 |
smarty24 |
Hi I am new here. |
# |
Jul 2nd 2017, 02:26 |
ra7bi |
BTW , Thanks a lot Savant , |
# |
Jul 2nd 2017, 02:25 |
ra7bi |
but if this option is exist , i dont want to duplicate the code |
# |
Jul 2nd 2017, 02:25 |
savant |
there are composer packages that have them as a dependency you can call for |
# |
Jul 2nd 2017, 02:25 |
ra7bi |
im hardcoding the list in some file in my project |
# |
Jul 2nd 2017, 02:25 |
savant |
also doesnt really change that you’re hardcoding the list somewhere |
# |
Jul 2nd 2017, 02:25 |
ra7bi |
Yah correct |
# |
Jul 2nd 2017, 02:24 |
savant |
and that list would get out of date |
# |
Jul 2nd 2017, 02:24 |
savant |
that would mean they’d be hardcoded into the cake core |
# |
Jul 2nd 2017, 02:24 |
ra7bi |
Ah i thought there is an Form element for displaying kind of things |
# |
Jul 2nd 2017, 02:23 |
savant |
put it in the database and issue a find |
# |
Jul 2nd 2017, 02:23 |
ra7bi |
without hardcoding countries as array in controller and then call it from View |
# |
Jul 2nd 2017, 02:22 |
ra7bi |
is there any way to get countries list in the view ? |
# |
Jul 2nd 2017, 02:22 |
ra7bi |
i'v one more question |
# |
Jul 2nd 2017, 02:20 |
ra7bi |
Tks |
# |
Jul 2nd 2017, 02:20 |
ra7bi |
Sure , i'll check it out |
# |
Jul 2nd 2017, 02:19 |
savant |
there is an example there for changing the fields for a find(‘list’) |
# |
Jul 2nd 2017, 02:19 |
savant |
https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#finding-key-value-pairs |
# |
Jul 2nd 2017, 02:18 |
ra7bi |
this is my query |
# |
Jul 2nd 2017, 02:18 |
ra7bi |
``` $diseases = $this->Participants->Diseases->find('list', ['limit' => 200]); ``` |
# |
Jul 2nd 2017, 02:17 |
savant |
ok |
# |
Jul 2nd 2017, 02:17 |
savant |
gist.github.com |
# |
Jul 2nd 2017, 02:17 |
ra7bi |
i will check my find |
# |
Jul 2nd 2017, 02:17 |
savant |
show me the controller code you are using? |
# |
Jul 2nd 2017, 02:17 |
ra7bi |
Oh wait pls |
# |
Jul 2nd 2017, 02:17 |
ra7bi |
Can you please explain more with my example |
# |
Jul 2nd 2017, 02:17 |
savant |
you need to do it at the find level |
# |
Jul 2nd 2017, 02:17 |
savant |
you cant do it from the view |
# |
Jul 2nd 2017, 02:17 |
ra7bi |
Yep how i can change the fields from the view |
# |
Jul 2nd 2017, 02:17 |
savant |
but you can change the find fields to `id`, `eng_name` if you wish |
# |
Jul 2nd 2017, 02:16 |
savant |
by default we pull the primaryKey and the displayField |
# |
Jul 2nd 2017, 02:16 |
savant |
you can change the fields if you wish |
# |
Jul 2nd 2017, 02:16 |
ra7bi |
name for Arabic |
# |
Jul 2nd 2017, 02:16 |
ra7bi |
eng_name is for english language |
# |
Jul 2nd 2017, 02:16 |
savant |
change the Diseases->find(‘list’) to add conditions |
# |
Jul 2nd 2017, 02:16 |
ra7bi |
in diseases i'v name and eng_name |
# |
Jul 2nd 2017, 02:15 |
ra7bi |
``` echo $this->Form->input('diseases._ids', ['options' => $diseases]); ``` can i specify which column from diseases array should display ? |
# |
Jul 2nd 2017, 02:14 |
savant |
hi |
# |
Jul 2nd 2017, 02:14 |
ra7bi |
Hey |
# |
Jul 2nd 2017, 00:44 |
savant |
cool |
# |
Jul 2nd 2017, 00:43 |
spencdev |
yeah, definitely! thanks! |