# |
Mar 22nd 2019, 17:47 |
jhall |
no its not working |
# |
Mar 22nd 2019, 17:47 |
ricksaccous |
probably the better solution is to use https://book.cakephp.org/3.0/en/core-libraries/logging.html#Cake\Log\Log::write |
# |
Mar 22nd 2019, 17:46 |
ricksaccous |
is that not working? |
# |
Mar 22nd 2019, 17:45 |
jhall |
Do I need to do anything special @ricksaccous? |
# |
Mar 22nd 2019, 17:34 |
jhall |
okay I can try that |
# |
Mar 22nd 2019, 17:23 |
ricksaccous |
then you can instantiate that class and use it i assume |
# |
Mar 22nd 2019, 17:22 |
ricksaccous |
you probably need to use Cake\Log\Engine\FileLog assuming that's the one you've configured |
# |
Mar 22nd 2019, 17:22 |
ricksaccous |
@jhall look at Cake\Log\Engine\FileLog |
# |
Mar 22nd 2019, 17:01 |
jhall |
setup a listener? |
# |
Mar 22nd 2019, 17:01 |
jhall |
is it possible I need to reference a namespace or something? |
# |
Mar 22nd 2019, 17:00 |
jhall |
well tried that and it did nothing |
# |
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 |