# |
Mar 22nd 2019, 17:00 |
dereuromark |
$this->log()? |
# |
Mar 22nd 2019, 16:56 |
jhall |
If I want to write out some variable values of a command shell to the debug error log how do I go about doing that? Or how do I do this in general? |
# |
Mar 22nd 2019, 15:22 |
tjkalinowski |
:wave: |
# |
Mar 22nd 2019, 15:22 |
tjkalinowski |
Tanks !!!!! |
# |
Mar 22nd 2019, 15:22 |
ricksaccous |
lmao |
# |
Mar 22nd 2019, 15:22 |
tjkalinowski |
WORKED!! |
# |
Mar 22nd 2019, 15:22 |
ricksaccous |
@tjkalinowski please read what i linked |
# |
Mar 22nd 2019, 15:20 |
tjkalinowski |
@ricksaccous This piece of code works fine for me. But do not display start_date. |
# |
Mar 22nd 2019, 15:20 |
ricksaccous |
just do 'valueField' => function ($group) { return $group->group_name . ' ' . $group->start_date; } |
# |
Mar 22nd 2019, 15:19 |
ricksaccous |
@tjkalinowski https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#customize-key-value-output |
# |
Mar 22nd 2019, 15:16 |
ricksaccous |
you want to connect both fields |
# |
Mar 22nd 2019, 15:16 |
ricksaccous |
which is the same as concat.... |
# |
Mar 22nd 2019, 15:16 |
ricksaccous |
in the value |
# |
Mar 22nd 2019, 15:16 |
ricksaccous |
sounds like you want to combine group name and start date |
# |
Mar 22nd 2019, 15:14 |
tjkalinowski |
@ricksaccous No, just want to display Group name and Start date in drop down. The key is group_id. |
# |
Mar 22nd 2019, 15:07 |
dereuromark |
jep, true |
# |
Mar 22nd 2019, 15:06 |
hollistergraham123 |
I think if you add the map function you could easily concat the fields and create a virtual field from it |
# |
Mar 22nd 2019, 15:06 |
hollistergraham123 |
https://book.cakephp.org/3.0/en/orm/query-builder.html#queries-are-collection-objects |
# |
Mar 22nd 2019, 15:05 |
dereuromark |
contact would be a virtual db field then, or you can run a formatResults etc |
# |
Mar 22nd 2019, 15:04 |
ricksaccous |
are you trying to concat them? |
# |
Mar 22nd 2019, 15:04 |
tjkalinowski |
Hello, how to display drop down menu, with two valueFields, ex. group_name and start_date? |
# |
Mar 22nd 2019, 15:02 |
dereuromark |
there are ways to do that without explicitly having to. see awesome list, 1-2 plugins afaik. |
# |
Mar 22nd 2019, 15:02 |
dereuromark |
you should always pass it in from the outside into the model layer. |
# |
Mar 22nd 2019, 15:01 |
hollistergraham123 |
Then in that case what is the best way to access the logged in user in the finder. Should I just import the Auth component into the table class or should I pass in the user from the controller |
# |
Mar 22nd 2019, 15:00 |
ricksaccous |
if you are not too concerned about that then go for it |
# |
Mar 22nd 2019, 15:00 |
ricksaccous |
using finders is great, there are just limitations when you use them on associations regarding pagination |
# |
Mar 22nd 2019, 15:00 |
hollistergraham123 |
I’ve never seen a guide suggesting it which leads me to think it’s not best practice but I’m curious as to why not. Seems like it would save on coding |
# |
Mar 22nd 2019, 14:59 |
slackebot2 |
and don’t have to keep rewriting boiler plate code. Or is there a reason not to do that |
# |
Mar 22nd 2019, 14:59 |
hollistergraham123 |
Right, so the query is always scope by wether they are in an active store or they are in the dashboard view which pulls back all the data from all stores they are associated with. Right now I have to write that where clause into every single query I write because they all need to be scoped that way. My question is, is that the best way to do it. Or should I write a custom finder to use on all associations so they are auto scoped |
# |
Mar 22nd 2019, 14:37 |
ricksaccous |
I'd also be wary of using finders to define associations, it's probably better to use conditions when you can |
# |
Mar 22nd 2019, 14:35 |
ricksaccous |
and that you will always change the query based on the active store |
# |
Mar 22nd 2019, 14:35 |
ricksaccous |
or are you saying you always will pass the active store to the query |
# |
Mar 22nd 2019, 14:34 |
ricksaccous |
you need to be more specific about what you want from a query perspective, do you want to filter by conditions in an association? |
# |
Mar 22nd 2019, 14:33 |
slackebot2 |
<hollistergraham123> |
# |
Mar 22nd 2019, 14:31 |
hollistergraham123 |
Hey, I had a quick question about defining associations. I have a company that hasmany stores. And users which belongToOne company and belongToMany stores. Then from there the stores basically own everything along with a user association for actions. I know that when defining relationships in the table file you can define a custom finder method. Basically every query I write has to include a scoping statement of |
# |
Mar 22nd 2019, 14:24 |
devito |
thank |
# |
Mar 22nd 2019, 14:22 |
dereuromark |
read the current migration guide, as well as the wiki 4.0 milestone/log |
# |
Mar 22nd 2019, 14:16 |
devito |
is there a 4.0 feature list out yet by chance? |
# |
Mar 22nd 2019, 13:49 |
hollistergraham123 |
Will do! Thanks. |
# |
Mar 22nd 2019, 13:47 |
ricksaccous |
if you have any questions feel free to ask, be sure to read the docs/cookbook |
# |
Mar 22nd 2019, 13:47 |
ricksaccous |
just kidding, nice to have you |