# |
Jun 24th 2019, 09:12 |
steinkel |
@dereuromark using syslog here, then letting syslog fw it elsewhere |
# |
Jun 24th 2019, 09:10 |
dereuromark |
See https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md#log-specific-servers-and-networked-logging |
# |
Jun 24th 2019, 09:10 |
dereuromark |
with monolog you can log to anything without having to change more than config, ideally that one as wrapper then |
# |
Jun 24th 2019, 09:09 |
conehead |
What logging? I am logging to graylog |
# |
Jun 24th 2019, 08:57 |
dereuromark |
I am surprised to not see any (monolog) wrapper logging engine in awesome list. what are people using these days? besides the database log maybe? |
# |
Jun 24th 2019, 08:28 |
dereuromark |
capability of retry is definitely powerful and useful here, same for better usability as you dont have the waiting time on the frontend. |
# |
Jun 24th 2019, 08:27 |
dereuromark |
@joey.mukherjee You can even use the queue usually for tasks that should be started right away, as with a good setup you have only a lag of a few seconds. it would only wait a few more if the workers are still all busy. |
# |
Jun 24th 2019, 08:26 |
dereuromark |
But this is usually not adviced for things that need to run longer than a second, or if those could be failing and could need a rerun. |
# |
Jun 24th 2019, 03:16 |
admad |
@joey.mukherjee if you want to trigger a task your self there's no need to use the queue plugin. Just run the shell/command your self with `exec()/shell_exec()` function |
# |
Jun 24th 2019, 02:23 |
joey.mukherjee |
Thanks @challgren! Can you explain "If you just want to call the queue task then call your custom task" a little bit. By call my custom task, do you mean run the task without the queue? I am looking for a way to start the task immediately or trigger it somehow so it starts? Ideally, I'd rather not use cron if I can help it. |
# |
Jun 24th 2019, 01:50 |
challgren |
You should always run it from the Shell. Running it from a web request will block that connection and eventually timeout. If you just want to call the queue task then call your custom task |
# |
Jun 23rd 2019, 23:34 |
joey.mukherjee |
With the dereuromark/cakephp-queue plugin, is there a way to start the queued workers from my app instead of using a cronjob? I tried using a ShellDispatcher but it waits for a response. I am doing this in case I can tweak it: ``` $shell = new ShellDispatcher (); $command = ['cake', 'queue', 'runworker', 'and']; $output = $shell->run ($command);``` |
# |
Jun 23rd 2019, 19:39 |
vossen.steven |
@madbbb ok ty, I'll have to check out my host then to see how I can access it |
# |
Jun 23rd 2019, 19:39 |
vossen.steven |
I checked my db, it was only on the db not on the tables |
# |
Jun 23rd 2019, 18:15 |
madbbb |
you always have access to mysql encoding settings on shared hosting |
# |
Jun 23rd 2019, 18:15 |
niel45 |
@vossen.steven isn't utf8mb4 set on the individual database or table? |
# |
Jun 23rd 2019, 18:01 |
vossen.steven |
figured it out with your help, I have to add this to my.ini `character-set-server = utf8mb4` how would one fix this if they don't have access to it though? |
# |
Jun 23rd 2019, 17:31 |
slackebot |
encoding anymore in my code |
# |
Jun 23rd 2019, 17:31 |
madbbb |
my seeds with Russian characters work fine with this settings: app.php Datasources['default']['encoding'] uses default utf8 and I use docker version of mysql 5.7.23 with override.cnf with this settings: ```[client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci ``` I don't have to specify collation or |
# |
Jun 23rd 2019, 17:17 |
vossen.steven |
cause as far as I know you can't pass a collation and I have no clue where it's getting it from |
# |
Jun 23rd 2019, 17:16 |
vossen.steven |
and that doesn't fix the issue if you use newEntity either |
# |
Jun 23rd 2019, 17:15 |
vossen.steven |
so if i do this ``` $data = ['charr' => 'ë']; $table = $this->table('test', ['collation' => 'utf8mb4_unicode_ci']); $table->insert($data)->save(); ``` it works fine, but it seems to me it shouldn't be like that, because if I change my datasource encoding I would have to change that as well |
# |
Jun 23rd 2019, 17:10 |
vossen.steven |
if i pass `'collation' => 'utf8mb4_unicode_ci'` as option when I call $this->table in the seeder it works fine |
# |
Jun 23rd 2019, 17:09 |
vossen.steven |
been reading the docs and I might have a solution |
# |
Jun 23rd 2019, 17:08 |
vossen.steven |
both utf8mb4 |
# |
Jun 23rd 2019, 17:02 |
madbbb |
@vossen.steven what's is your table collation and Datasource.encoding? |
# |
Jun 23rd 2019, 15:49 |
slackebot |
object(Cake\ORM\Entity) { 'id' => (int) 2, 'charr' => 'ë', } ] ``` as you can see the seeder doesn't encode the data properly. |
# |
Jun 23rd 2019, 15:49 |
vossen.steven |
Does anyone know how to get the seeder to encode data properly? I have the following test in my controller and a seeder ``` $testTable = TableRegistry::get('test'); $new = $testTable->newEntity([ 'charr' => 'ë', ]); $testTable->save($new); ``` now when I retrieve the data I get ``` [ (int) 0 => object(Cake\ORM\Entity) { 'id' => (int) 1, 'charr' => 'ë', }, (int) 1 => |
# |
Jun 23rd 2019, 15:06 |
olanowsubomi |
hello, goodday. please can i asked some few questions concerning cakephp download |
# |
Jun 23rd 2019, 08:23 |
challgren |
Does anyone have any pros vs cons for using CakePHP over .NET core? Client wants to use .NET and I want to persuade him otherwise |
# |
Jun 22nd 2019, 19:14 |
joey.mukherjee |
Nevermind! I can just move my $userGroups into the function ($q)! Cool! |
# |
Jun 22nd 2019, 19:11 |
slackebot1 |
return $q->where (['OR' => ['Groups.name' => 'public', 'Groups.id IN' => $userGroups]]); });``` These queries work independently. However, by doing a subquery, I get an `Undefined variable: userGroups` error. clearly userGroups is there in the line before. Any ideas? |
# |
Jun 22nd 2019, 19:11 |
joey.mukherjee |
I've made some progress on my querying, but I'm having one more issue: ``` $userGroups = $this->Groups->find ()->select (['id']) ->matching ('MyUsers', function ($q) { return $q->where (['MyUsers.id' => $this->Auth->user ('id')]); }); $query = $this->Projects->find ()->select (['name']) ->matching ('Groups', function ($q) { |
# |
Jun 22nd 2019, 19:04 |
madbbb |
and now all models' beforeMarshal event fire this listener. How do I connect to only InvoiceTable model? |
# |
Jun 22nd 2019, 19:01 |
madbbb |
I want to move all my events to listener class to keep all callbacks in one place. bootstrap.php: $invoices = TableRegistry::get('Invoices'); $invoiceListener = new InvoiceListener(); EventManager::instance()->attach($invoiceListener); invoicelistener.php: class InvoiceListener implements EventListenerInterface { public function implementedEvents() { return [ 'Model.beforeMarshal' => 'test', ]; } |
# |
Jun 22nd 2019, 18:52 |
Chetan |
Can anyone tell me, how to update cakephp 3.7.8 to 4.0 alpha 1 ? |
# |
Jun 22nd 2019, 18:48 |
chetanvarshney |
Please help me, How to Update cakephp 3.7.8 to 4.0 alpha1 ?? |
# |
Jun 22nd 2019, 18:47 |
chetanvarshney |
Hello |
# |
Jun 22nd 2019, 16:43 |
joey.mukherjee |
Maybe this is easier: ``` $query = $this->Projects->find ()->select (['name'])->contain (['Groups']) ->innerJoinWith ('Groups', function ($q) { return $q->where (['Groups.name' => 'public']); })->all ();``` How do I also add the groups the user is part of to this query? |
# |
Jun 22nd 2019, 16:37 |
joey.mukherjee |
I actually have both of them as "belongsToMany" since my users can be part of many groups and groups can have many users. But I guess what I am after is how to use "find" on something like this. Ideally, I want to join it with another table (Projects) but I can't even get the initial find to work. |
# |
Jun 22nd 2019, 16:25 |
admad |
GroupsUsers belongsTo Users and belongsTo Groups, then contain them |