# |
May 21st 2019, 09:29 |
neon1024 |
My mistake, my test was wrong |
# |
May 21st 2019, 09:28 |
neon1024 |
Test-case passes, so it’s just my code. I wonder what I’ve done wrong |
# |
May 21st 2019, 09:23 |
neon1024 |
See if I can replicate it |
# |
May 21st 2019, 09:23 |
neon1024 |
I’m going to add a test-case |
# |
May 21st 2019, 09:21 |
dereuromark |
keep ?? or use my CastTrait. i use it for phpstan level 7 code. |
# |
May 21st 2019, 09:20 |
admad |
> If the posted value was missing, you’d expect `0` right? Yes I would |
# |
May 21st 2019, 09:08 |
neon1024 |
Which doesn’t feel right at all |
# |
May 21st 2019, 09:08 |
neon1024 |
`empty($this->getRequest()->getData('payment_charge_amount')) ? 0 : $this->getRequest()->getData('payment_charge_amount'),` |
# |
May 21st 2019, 09:08 |
neon1024 |
THen you end up with |
# |
May 21st 2019, 09:06 |
neon1024 |
Which leads to `$this->getRequest()->getData('payment_charge_amount') ?? 0` which defeats the point of the default value right? |
# |
May 21st 2019, 09:05 |
neon1024 |
:thinking_face: |
# |
May 21st 2019, 09:05 |
neon1024 |
`CallsController.php:203:null` |
# |
May 21st 2019, 09:05 |
neon1024 |
If the posted value was missing, you’d expect `0` right? |
# |
May 21st 2019, 09:05 |
neon1024 |
`$this->getRequest()->getData('payment_charge_amount', 0)` |
# |
May 21st 2019, 09:05 |
neon1024 |
So |
# |
May 21st 2019, 08:53 |
neon1024 |
Perhaps it’s a hasMany, and is generating an extra query, and the order has been moved to the other query |
# |
May 21st 2019, 08:14 |
willem |
what could be the reason this order by is removed from the resulting query? ``` ->contain( [ 'CompanyBookBalances.CompanyBooks' => function ($q) { return $q->order(['CompanyBooks.name' => 'ASC']); } ] ) ``` |
# |
May 21st 2019, 07:50 |
welo.lamacchia |
is there a way to make work custom filter from My Own Plugin ? |
# |
May 21st 2019, 07:48 |
welo.lamacchia |
i found it, sorry!! :slightly_smiling_face: |
# |
May 21st 2019, 07:47 |
admad |
@welo.lamacchia you will have the answer to that if you read it's documentation |
# |
May 21st 2019, 07:44 |
welo.lamacchia |
hello, in FriendsOfCake Search is there a way to create custom Filter like value, boolean, compare etc ? |
# |
May 21st 2019, 07:40 |
k4t |
hello |
# |
May 21st 2019, 07:38 |
neon1024 |
Morning all :wave: |
# |
May 21st 2019, 07:08 |
admad |
@waspinator patching requires entity for the associations to be already present in entity you are patching |
# |
May 21st 2019, 02:38 |
waspinator |
it has a belongsToMany('Editors') and belongsToMany('Writers'), both of which are of `->setClassName('Users')` |
# |
May 21st 2019, 02:37 |
waspinator |
``` object(App\Model\Entity\Group) { 'name' => 'test group', '[new]' => true, '[accessible]' => [ 'name' => true, 'editors_groups' => true, 'groups_writers' => true ], '[dirty]' => [ 'name' => true ], '[original]' => [], '[virtual]' => [], '[hasErrors]' => false, '[errors]' => [], '[invalid]' => [], '[repository]' => 'Groups' } ``` |
# |
May 21st 2019, 02:15 |
turkles |
What does group look like if you dd() or log() ? |
# |
May 20th 2019, 22:31 |
waspinator |
that should work right? |
# |
May 20th 2019, 22:30 |
slackebot |
$this->Groups->save($group); ``` |
# |
May 20th 2019, 22:30 |
waspinator |
I'm trying to `patchEntity` with `belongsToMany` associated data, but it doesn't get added. ``` $group = $this->Groups->newEntity(); $data = [ 'name' => 'test group', 'editors' => [ '_ids' => [ (int) 0 => '1' ] ], 'writers' => [ '_ids' => [ (int) 0 => '2' ] ] ]; $group = $this->Groups->patchEntity($group, $data, [ 'associated' => ['Editors', 'Writers'] ]); |
# |
May 20th 2019, 21:59 |
dereuromark |
there are tools that are supposed to find them as well out there |
# |
May 20th 2019, 21:59 |
dereuromark |
rightclick => usage can sometimes work in your IDE, otherwise code coverage or just delete and see what breaks |
# |
May 20th 2019, 21:56 |
swimboy |
Is there an easy way to identify classes that are no longer being used? I have a project that has had some significant restructuring and I think that there are a lot of classes that were only included for code that’s since been removed. |
# |
May 20th 2019, 19:46 |
slackebot |
SQL error is displayed: Unknown column 'Profiles.tour_guide_id' in 'on clause' This is because CakePHP tries to join a tour guide's profile using the column profiles.tour_guide_id instead of profiles.user_id This combination worked fine in CakePHP 1.3 but I'm having trouble with CakePHP 3 (tried with 3.7.7). Is what I want to do even possible? What am I missing? Thanks for your help and advice in advance. |
# |
May 20th 2019, 19:46 |
michaelze |
I have three tables: - tours - users - profiles These have the following associations: ToursTable: $this->belongsTo('TourGuides', [ 'className' => 'Users', ]); // the foreignKey column is called tours.tour_guide_id UsersTable: $this->hasOne('Profiles'); ProfilesTable: $this->belongsTo('Users'); When I perform the following query: $this->Tours->query()->contain(['TourGuides', 'TourGuides.Profiles']) the following |
# |
May 20th 2019, 18:45 |
beakman |
Here's an example on an encrypted database type: https://github.com/bcrowe/cakephp-encrypted-type/blob/master/src/Database/Type/EncryptedType.php Not sure if it'll help, maybe. |
# |
May 20th 2019, 18:33 |
vinicius.big |
hello all! I need to create a JS file along with my index.ctp using bake command. Does anyone have an example of that? |
# |
May 20th 2019, 18:30 |
admad |
@manthan.budheliya show your type class |
# |
May 20th 2019, 17:58 |
manthan.budheliya |
cakephp version is 3.7 |
# |
May 20th 2019, 17:58 |
manthan.budheliya |
is there anybody who have some idea? |
# |
May 20th 2019, 17:57 |
manthan.budheliya |
Hello friends, I have created a custom data type as I wanted to add 2 way encryption to some of my fields. The problem is toPHP function is working but toDatabase function is not calling from any of the possible way. |