# |
Jan 9th 2020, 15:47 |
neothermic |
in cake2's form helper, you had the before/between/after for throwing stuff inbetween generated labels and inputs. Cake3 doesn't seem to have these anymore, is there a way to still do this? |
# |
Jan 9th 2020, 15:27 |
admad |
@val test cases are the best examples |
# |
Jan 9th 2020, 15:15 |
ricksaccous |
i dunno then, oh wells |
# |
Jan 9th 2020, 15:15 |
ricksaccous |
that didn't work |
# |
Jan 9th 2020, 15:15 |
ricksaccous |
welp |
# |
Jan 9th 2020, 15:14 |
ricksaccous |
echo $this->Form->create(['well' => 'okay']); echo $this->Form->control('well'); echo $this->Form->end(); |
# |
Jan 9th 2020, 15:13 |
ricksaccous |
it would most likely match array key to array value |
# |
Jan 9th 2020, 15:13 |
val |
to try what? `$this->Form->create([]);` ? |
# |
Jan 9th 2020, 15:13 |
ricksaccous |
just try it, lell |
# |
Jan 9th 2020, 15:13 |
val |
an example would be helpful |
# |
Jan 9th 2020, 15:12 |
ricksaccous |
@val you could prob just set an array to the view if you want and use that |
# |
Jan 9th 2020, 15:12 |
ricksaccous |
have you tried something and it failed? |
# |
Jan 9th 2020, 15:06 |
val |
https://api.cakephp.org/3.8/class-Cake.View.Helper.FormHelper.html#_create ```The context for which the form is being defined. Can be a ContextInterface instance, ORM entity, ORM resultset, or an array of meta data.``` Is there an example when `$context` is an array of meta data? I cannot find it in the cookbook - https://book.cakephp.org/3/en/views/helpers/form.html#Cake\View\Helper\FormHelper::create |
# |
Jan 9th 2020, 14:58 |
sdevore |
https://book.cakephp.org/3/en/orm/query-builder.html#sql-injection-prevention |
# |
Jan 9th 2020, 14:47 |
ricksaccous |
you gotta bind those params |
# |
Jan 9th 2020, 14:09 |
ndm |
Well, let's call it "(user) data", given that I don't know where `$id` comes from, but even if it's not user data currently (ie data sent by the user(agent) to your application), you never know when someone might make a change for the source of `$id`, so don't even start with inserting (user) data into queries directly. |
# |
Jan 9th 2020, 14:06 |
alexdd55976 |
@ndm not sure what you mean with user data? |
# |
Jan 9th 2020, 14:04 |
ndm |
@alexdd55976 It's still really bad form, never insert user data into queries if you can avoid it, always use bindings when possible, don't let stuff like that slip |
# |
Jan 9th 2020, 14:03 |
alexdd55976 |
@sdevore thanks :) |
# |
Jan 9th 2020, 14:02 |
sdevore |
Also https://book.cakephp.org/3/en/orm/query-builder.html#advanced-conditions there is a bit on notIn I have to run a kid to school but will be back in about an hour if you are still stuck ;) But I have faith that in my absence insight will be self discovered ;) |
# |
Jan 9th 2020, 14:02 |
alexdd55976 |
@dereuromark good point thanks. i will forward him the message.. i am not in the office |
# |
Jan 9th 2020, 14:01 |
dereuromark |
The $id is better (int) casted, otherwise you might open yourself to sql injections^^ |
# |
Jan 9th 2020, 14:01 |
sdevore |
check out https://book.cakephp.org/3/en/orm/query-builder.html#subqueries |
# |
Jan 9th 2020, 14:00 |
alexdd55976 |
the subselect is the big issue |
# |
Jan 9th 2020, 13:59 |
alexdd55976 |
bu i am sure there is a more cakey way to do that |
# |
Jan 9th 2020, 13:59 |
ndm |
ouch |
# |
Jan 9th 2020, 13:59 |
alexdd55976 |
a colleague did that ```$this->Departments->find() ->where([ 'departments.active' => 1, 'departments.id NOT IN (SELECT DISTINCT department_id FROM users_departments where user_id <> ' . $id . ' )', ]);``` |
# |
Jan 9th 2020, 13:58 |
slackebot |
`Departments__modified` FROM departments Departments WHERE ( departments.active = '1' AND departments.id NOT IN ( SELECT DISTINCT department_id FROM users_departments where user_id <> 1 ) )``` |
# |
Jan 9th 2020, 13:58 |
alexdd55976 |
can somebody help me bringing the following statement to orm query? ```SELECT Departments.id AS `Departments__id`, Departments.name AS `Departments__name`, Departments.user_id AS `Departments__user_id`, Departments.is_root AS `Departments__is_root`, Departments.parent_id AS `Departments__parent_id`, Departments.active AS `Departments__active`, Departments.created AS `Departments__created`, Departments.modified AS |
# |
Jan 9th 2020, 13:58 |
ndm |
I heard everybody loves Upwork ;) |
# |
Jan 9th 2020, 13:49 |
spriz |
Do you guys know anywhere awesome to post a Cake job? :) |
# |
Jan 9th 2020, 12:03 |
tibor.hajos |
Great, thank you. I'll see how long it takes for me to get stuck :P |
# |
Jan 9th 2020, 12:01 |
dereuromark |
Jep, and you can use cake4 branch of sandbox to real life test it. Helped me a lot. |
# |
Jan 9th 2020, 12:00 |
tibor.hajos |
Cool, I made a note of it. I'll probably need some help in figuring out how to upgrade everything, as Cake is still new for me. Is it best to just pull everything, see what's broken and fix it? |
# |
Jan 9th 2020, 11:56 |
dereuromark |
Tools, Setup, Tags, Ratings, Geo probably, in that order. rest doesnt seem to be needed for a while^^ |
# |
Jan 9th 2020, 11:53 |
tibor.hajos |
Sure, I can get some hours in this weekend. Which issue has the best necessity/difficulty ratio? |
# |
Jan 9th 2020, 11:39 |
dereuromark |
Anyone interested in helping to get the plugins Cache, Tags, Ratings, Geo, Translate, Captcha, Tools, Setup etc ready for Cake4? A little help is needed, I did already most of the hard part here :) Having already upgraded 10+ others, I appreciate the assistance. |
# |
Jan 9th 2020, 10:33 |
jotpe |
Handle doesn't get passed to the Paginator and the route is obviously not found. |
# |
Jan 9th 2020, 10:31 |
slackebot |
<jotpe> |
# |
Jan 9th 2020, 10:31 |
jotpe |
I use BootstrapUI and have a route with 2 variables, but one doesn't get passed: |
# |
Jan 9th 2020, 10:30 |
jotpe |
Anyone knows how to pass a variable to a the PaginatorHelper? |