Log message #4217145

# At Username Text
# Dec 3rd 2019, 12:47 javier.villanueva $this->belongsToMany('NearCities', [ 'foreignKey' => 'city1_id', 'targetForeignKey' => 'city2_id', 'joinTable' => 'cities_cities' ]);
# Dec 3rd 2019, 12:45 javier.villanueva yes you can
# Dec 3rd 2019, 12:44 david I have a "cities" which are near (or not) some of them to others. "cities_near" is a join table with "city1_id" and "city2_id". When a city is near to one, that one is near to the other. Can I do that in a smart way with belongsToMany?
# Dec 3rd 2019, 12:30 javier.villanueva not is correct.... i check
# Dec 3rd 2019, 12:29 javier.villanueva https://pastebin.com/4sp9YnWM
# Dec 3rd 2019, 12:28 javier.villanueva the patched information looks ok
# Dec 3rd 2019, 12:24 neon1024 I think you meant to use `'foreignKey' => 'dog_id', 'targetForeignKey' => 'id'`
# Dec 3rd 2019, 12:24 neon1024 @gianmarxgagliardi Because you’ve set an incorrect foreignKey I think. :point_right: https://book.cakephp.org/3/en/orm/associations.html#belongsto-associations
# Dec 3rd 2019, 12:20 javier.villanueva i will try
# Dec 3rd 2019, 12:20 javier.villanueva ok
# Dec 3rd 2019, 12:19 neon1024 @javier.villanueva You might need to include the tables in the `associated` options key for `patchEntity` too if they don’t marshall properly
# Dec 3rd 2019, 12:18 javier.villanueva uhm ok
# Dec 3rd 2019, 12:17 neon1024 ..which people on IRC can’t even read
# Dec 3rd 2019, 12:17 neon1024 Could you pastebin perhaps? Rather than filling the whole channel with code?
# Dec 3rd 2019, 12:17 neon1024 I would also dump the resulting entity after `patchEntity` to make sure it’s marhsalled prop…
# Dec 3rd 2019, 12:17 slackebot index() { $result = $this->DogsCats->find('all')->contain(['Dogs','Cats']); $this->set('farms',$result); } }```
# Dec 3rd 2019, 12:17 slackebot ]); $this->belongsTo('Cats', [ 'foreignKey' => 'id', 'joinType'=>'INNER', ]); } }``` Controller/DogsCats ```<?php namespace App\Controller; class DogsCatsController extends AppController { public function initialize() { parent::initialize(); $this->loadComponent('Paginator'); $this->loadComponent('Flash'); // Include the FlashComponent } public function
# Dec 3rd 2019, 12:17 slackebot 'foreignKey'=>'cat_id' ]); } }``` Model/Table/DogsCats ```<?php use App\Model\Entity\DogCat; use Cake\ORM\Table; use Cake\ORM\Query; use Cake\ORM\RulesChecker; use Cake\ORM\Validation\Validator; class DogsCatsTable extends Table { public function initialize(array $config) { $this->addBehavior('Timestamp'); $this->belongsTo('Dogs', [ 'foreignKey' => 'id', 'joinType'=>'INNER',
# Dec 3rd 2019, 12:17 slackebot $this->addBehavior('Timestamp'); $this->hasMany('DogsCats',[ 'foreignKey'=>'dog_id' ]); } }``` Model/Table/Cats ```<?php use App\Model\Entity\Cat; use Cake\ORM\Table; use Cake\ORM\Query; use Cake\ORM\RulesChecker; use Cake\ORM\Validation\Validator; class CatsTable extends Table { public function initialize(array $config) { $this->addBehavior('Timestamp'); $this->hasMany('DogsCats',[
# Dec 3rd 2019, 12:17 gianmarxgagliardi from this error I don't understand why I read in the documentation but I couldn't solve The Dogs association is not defined on DogsCats. InvalidArgumentException ```Model/Table/Dogs <?php use App\Model\Entity\Dog; use Cake\ORM\Table; use Cake\ORM\Query; use Cake\ORM\RulesChecker; use Cake\ORM\Validation\Validator; class DogsTable extends Table { public function initialize(array $config) {
# Dec 3rd 2019, 12:17 javier.villanueva mm
# Dec 3rd 2019, 12:16 neon1024 Yeah, I’d say you’re missing an id for the third dimension of data, which would make it an insert
# Dec 3rd 2019, 12:12 javier.villanueva I make ```$installation = $this->Installations->patchEntity($installation, $data, ['associated' => [ 'InstallationsDocumentClasses._joinData' ] ]); ```
# Dec 3rd 2019, 12:09 javier.villanueva In the log I see that make "DELETE FROM installations_document_classes WHERE document_class_id = 2" (that is wrong too)
# Dec 3rd 2019, 12:08 javier.villanueva Is there something wrong with that array?
# Dec 3rd 2019, 12:08 javier.villanueva But, always I have an error and rollback....
# Dec 3rd 2019, 12:07 javier.villanueva Saving an Installation. And the "ids" in this array are document_classes
# Dec 3rd 2019, 12:07 javier.villanueva ` ```"installations_document_classes" => array:3 [▼ 1 => array:2 [▼ "_joinData" => array:2 [▼ "internal" => true "external" => true ] "id" => 1 ] 2 => array:2 [▼ "_joinData" => array:2 [▼ "internal" => true "external" => true ] "id" => 2 ] 3 => array:1 [▼ "_joinData" => array:1 [▼ "internal" => true ] ] ] `
# Dec 3rd 2019, 12:06 javier.villanueva And I try to patch this :
# Dec 3rd 2019, 12:06 javier.villanueva Hi... a question. I have this belongsToMany table: [ id | installation_id | document_class_id | internal | external ]
# Dec 3rd 2019, 10:29 challgren I think my tests namespace is all messed up
# Dec 3rd 2019, 10:22 alexdd55976 morning
# Dec 3rd 2019, 10:09 neon1024 PEBKAC
# Dec 3rd 2019, 10:06 noel With xdebug I'm steppeing through the code and able to get to a certain point. But if I put a break point in at that point and run instead of step, then it doesn't break. Has anyone experienced this? Any ideas why?
# Dec 3rd 2019, 09:56 turkles ok odd console thing was... php.ini had short tags disabled
# Dec 3rd 2019, 09:10 challgren another plugin converted to 4.x https://github.com/bcrowe/cakephp-encrypted-type/pull/3
# Dec 3rd 2019, 09:08 spriz (the `App` folder :slightly_smiling_face: )
# Dec 3rd 2019, 09:08 spriz @brian.french Here you can see a "full blown" app in `tests` :slightly_smiling_face: https://github.com/FriendsOfCake/crud/tree/master/tests
# Dec 3rd 2019, 08:55 neon1024 I haven’t
# Dec 3rd 2019, 08:53 turkles Has anyone seen this before?
# Dec 3rd 2019, 08:53 turkles arghhhh I haven't touched cake in a while, and had to re-install php on my mac (brew, @7.3). my app is cake 3.8, and somehow my shell code is reading out all of the files in the Shell folder, rather than parsing them?