Log message #4262437

# At Username Text
# May 5th 2021, 15:50 kevin.pfeifer :)
# May 5th 2021, 15:49 devito feels dirty not doing it the “right way”
# May 5th 2021, 15:48 kevin.pfeifer sure you can do it like that as well
# May 5th 2021, 15:48 kevin.pfeifer ok
# May 5th 2021, 15:47 devito sorry, so right now. I added the pk id column to the join table. Then I saved my data. the operation is successfull and the link is made. Data is populated with the correct feed_id and slug_id
# May 5th 2021, 15:41 kevin.pfeifer what do you mean by that? add the id field to the table in the database?
# May 5th 2021, 15:32 devito If I add the id to the table and then save, all is good in the world
# May 5th 2021, 15:32 devito when I patch the entity i do see the associated entites are marshaled and created before save.
# May 5th 2021, 15:31 devito and I am declaring the “field” in acessable
# May 5th 2021, 15:31 devito so the associations are correct in both models
# May 5th 2021, 15:29 devito actully no, thats all there….
# May 5th 2021, 15:28 devito let me try that real quick
# May 5th 2021, 15:28 devito i think my issue is that im missing targetForeignKey and jointable on my associations
# May 5th 2021, 15:28 devito ooo i see hmm
# May 5th 2021, 15:27 ndm The primary key can be created from the two foreign key columns.
# May 5th 2021, 15:26 ndm The table still needs a primary key (that doesn't mean an additional column)
# May 5th 2021, 15:25 kevin.pfeifer but if you stick with the cakephp naming conventions for tables and columns it should basically put everything where it belongs
# May 5th 2021, 15:21 kevin.pfeifer is the fact, that the "field" needs to set as accessible in the entity ```src/Model/Entity/Category.php protected $_accessible = [ 'name' => true, 'created' => true, 'modified' => true, 'ftp_domains' => true, ]; src/Model/Entity/FtpDomain.php protected $_accessible = [ .... 'categories' => true, .... ];```
# May 5th 2021, 15:20 kevin.pfeifer the only thing I remember being strange about this
# May 5th 2021, 15:19 kevin.pfeifer the join table doesn't need to be baked aka no seperate controller, model, template etc.
# May 5th 2021, 15:18 slackebot => 'ftp_domain_categories' ] );```
# May 5th 2021, 15:18 kevin.pfeifer ```src/Model/Table/FtpDomainsTable.php $this->belongsToMany( 'Categories', [ 'foreignKey' => 'ftp_domain_id', 'targetForeignKey' => 'category_id', 'joinTable' => 'ftp_domain_categories' ] ); src/Model/Table/CategoriesTable.php $this->belongsToMany( 'FtpDomains', [ 'foreignKey' => 'category_id', 'targetForeignKey' => 'ftp_domain_id', 'joinTable'
# May 5th 2021, 15:17 devito yeah currently my table only has the 2 columns
# May 5th 2021, 15:15 kevin.pfeifer like that
# May 5th 2021, 15:15 devito Ive got an existing table and i want to make a migration to add the pk id column, is there a special option i need to include to do this? I read in the documentation the phinx will make an id col for u but I already have the table
# May 5th 2021, 15:14 kevin.pfeifer well a "basic" belongstomany connection without any further fields and just the 2 foreign keys doesn't need its own id
# May 5th 2021, 15:14 devito thanks
# May 5th 2021, 15:14 devito gotcha
# May 5th 2021, 15:08 ndm All tables require a primary key if you want to save data to them via the ORM.
# May 5th 2021, 14:52 devito ```do junction tables in cake3 require a pk id?```
# May 5th 2021, 14:51 devito ```Cannot insert row in "feeds_slugs" table, it has no primary key.```
# May 5th 2021, 14:51 devito im getting this error right now
# May 5th 2021, 14:51 devito save returns true
# May 5th 2021, 14:34 greg138 The attribute is showing as dirty? Are changes to the main entity saved? Are there errors noted in any of the entities or your logs? Does the save function return false?
# May 5th 2021, 14:22 devito after i patch the entity i see the attribute populated with individual records its jus tnot saving. a real head scratcher this oen is
# May 5th 2021, 14:19 devito hello everyone. I am having a wierd problem. My BTM relationship isnt saving. Im converting my ids into _ids array and then passing it to patchentity on the main model but when it saves the junction table does not reflect the associated items. anyone have any ideas why this would happen? Im also setting ids only in the patchentity options to true
# May 5th 2021, 14:11 me1367 yea, just lookup each package, slap the versions that should be compatible (or in the case with the ones I'm trying to fix, want to make compatible) and then run the command
# May 5th 2021, 14:08 kevin.pfeifer “working” versions depend on what cakephp base version you are using
# May 5th 2021, 14:07 me1367 I'll try what Kevin said...
# May 5th 2021, 14:04 kevin.pfeifer you need to adjust the composer.json to the “working” version strings and the perform `composer update --with-dependencies`
# May 5th 2021, 14:04 ndm Well somewhere there's still a reference to an old bake that needs to be updated