Log message #4190528

# At Username Text
# 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
# Jun 22nd 2019, 16:14 joey.mukherjee Can someone show me the CakePHP way of expressing this SQL statement: `select groups.id, groups.name from groups_users join users on users.id=groups_users.user_id join groups on groups.id=groups_users.group_id;` assuming I have my Model/Tables defined correctly?
# Jun 22nd 2019, 14:16 Demeter Hello
# Jun 22nd 2019, 12:08 slackebot1 for now
# Jun 22nd 2019, 12:08 bgrinter @challgren thanks - we actually use CakePDF now. Its more a function of the engine, CakePdf uses dompdf, Tcpdf and WkHtmlToPdf among others. From what I've read I should look at Tcpdf We're on CakePHP 2.x and planning to migrate to 3 so there's a bit of a backlog - this is a feature that'll only be used by a handful of users (although a vocal handful) so I might put on the back burner now. There's other features that'll offer more benefit
# Jun 22nd 2019, 11:59 challgren @bgrinter check out https://github.com/FriendsOfCake/CakePdf
# Jun 22nd 2019, 11:13 bgrinter Hi all - I'm currently using dompdf to create PDF documents in an app for a volunteer run youth group. One form we create is a parent permission form for events and I've had a request to have a form that the parent can sign with a digital signature. dompdf doesn't support this - does anyone have any experience with other PDF engines? I've heard TCPDF supports it
# Jun 22nd 2019, 07:06 madbbb Hello. I'm a little bit confused. When do you use CakePHP Event system and when model callbacks like afterSave? Should I put image uploading/processing in the event listener class when I save a post with an image attached to it?
# Jun 22nd 2019, 00:30 joey.mukherjee I have a belongsToMany association (Users and Groups - users can belong to many groups and groups can have many users). can someone give me an example of how to query the groups based on the user id?
# Jun 21st 2019, 23:30 rightscoreanalysis i did composer install before copying the site over
# Jun 21st 2019, 23:29 challgren ahh `composer install` should fix that
# Jun 21st 2019, 23:25 rightscoreanalysis thanks - it was the vendor directory which was wrong
# Jun 21st 2019, 23:18 mrfeedback and you could try to change debug level. maybe you get some output what happens :slightly_smiling_face:
# Jun 21st 2019, 23:16 mrfeedback is your documen root of the server set to webroot? and are you sure on your local install is mod_rewrite active?
# Jun 21st 2019, 22:45 rightscoreanalysis any ideas?
# Jun 21st 2019, 22:45 rightscoreanalysis i read the chapter on rewrites for apache
# Jun 21st 2019, 22:45 rightscoreanalysis server logs empty
# Jun 21st 2019, 22:45 rightscoreanalysis I have taken an old cake2 project form live environment, setup localhost version but when i try to open app it just hangs
# Jun 21st 2019, 20:43 daniel.upshaw :slightly_smiling_face:
# Jun 21st 2019, 19:27 joey.mukherjee Thanks for the suggestion Dan! It worked. I had a "Permission" config in my app.php which I had to take out for this to work. I'm not sure how I would have known that's what it was complaining about...
# Jun 21st 2019, 19:03 joey.mukherjee Is that the only way? It gets pretty far in building the roles stuff, but right after the roles controller, it says "Bake is detecting possible fixtures..." and then craters. :(
# Jun 21st 2019, 18:59 daniel.upshaw And then go through the install to try and find what's missing