Log message #4266821

# At Username Text
# Jun 29th 2021, 14:33 conehead that sucks :P
# Jun 29th 2021, 14:32 slackebot => 'projects_projects', 'foreignKey' => 'parent_id', 'targetForeignKey' => 'child_id' ] );```
# Jun 29th 2021, 14:32 kevin.pfeifer i e.g. use that to create child and parent projects like that ``` $this->belongsToMany( 'ParentProjects', [ 'className' => 'AlfredProjects.Projects', 'joinTable' => 'projects_projects', 'foreignKey' => 'child_id', 'targetForeignKey' => 'parent_id' ] ); $this->belongsToMany( 'ChildProjects', [ 'className' => 'AlfredProjects.Projects', 'joinTable'
# Jun 29th 2021, 14:32 conehead Ah...but that would mean in every conain I would have to use the Alias name as well?
# Jun 29th 2021, 14:29 kevin.pfeifer the first parameter is the alias. see the example here where hasOne is used to join on addresses multiple times https://book.cakephp.org/4/en/orm/associations.html#hasone-associations
# Jun 29th 2021, 14:27 dereuromark The alias is the name, so yes
# Jun 29th 2021, 14:19 conehead It is not just for behaviors, but for associations as well. Can I set the alias directly when setting an association? According to the documentation it is not a possible key https://book.cakephp.org/4/en/orm/associations.html#belongstomany-associations
# Jun 29th 2021, 14:18 erwane Autoanswer : pass the remember_me data in hidden field : https://github.com/andrej-griniuk/cakephp-two-factor-auth/issues/19
# Jun 29th 2021, 14:13 dereuromark i dont follow. how is setting it through manual table different? its both config. and couldn't this be adapted to some kind of auto-config flag? so it can work across all Tables then as improvement directly on the behavior? sounds useful if you extensively use it.
# Jun 29th 2021, 14:10 conehead @dereuromark Guess tomorrow I will try to create my own table class that will automatically set the alias to $Alias$AssocName for each and every association. Setting in the config does work for your plugin, but won't work for other associations as the alias cannot be set there
# Jun 29th 2021, 14:05 erwane hi, it's me again ;) I'm trying to configure TFA Authentication plugin (https://github.com/andrej-griniuk/cakephp-two-factor-auth) with the `CookieAuthenticator aka remember_me` The request loose the `remember_me` field in the intermediate check form and cookie is not set. Someone already has this issue ?
# Jun 29th 2021, 13:51 slackebot a transaction yourself you will need to dispatch that event yourself too
# Jun 29th 2021, 13:51 kevin.pfeifer this event is being dispatched by • `findOrCreate` https://github.com/cakephp/cakephp/blob/ab052da10dc5ceb2444c29aef838d10844fe5995/src/ORM/Table.php#L1624 • `save` https://github.com/cakephp/cakephp/blob/ab052da10dc5ceb2444c29aef838d10844fe5995/src/ORM/Table.php#L1875 • `saveMany` https://github.com/cakephp/cakephp/blob/ab052da10dc5ceb2444c29aef838d10844fe5995/src/ORM/Table.php#L2266 not anywhere else. So if you do
# Jun 29th 2021, 13:44 birdy247 If saving inside a transaction, does the afterSaveCommit not get called?
# Jun 29th 2021, 13:34 dereuromark I would do it in the init config, but yeah that sounds like it would solve it
# Jun 29th 2021, 13:24 slackebot { $this->addBehavior('Tag'); $this->Tags->setAlias($this->getAlias . 'Tags'); ...``` But I got a feeling it is not possible because if it was this easy, it would probably be already automatically in it?
# Jun 29th 2021, 13:24 conehead Yes, that goes into the right direction. Although I don't see it as an issue of your plugin, but as an general Cake issue. Issue is even the wrong word. It is convenient the way it is described in the documentation, but it looks like duplicate assoc names can be used. @dereuromark Do you think it would solve the problem to override the alias for each Table? Something like this: ```public function initialize(array $config): void
# Jun 29th 2021, 13:19 theblackbird.eu Okay i really think it's a problem with the htaccess because I can open any catalog on the server through the domain... But it's not cake releated so I'll look elswere, thank you all for help.
# Jun 29th 2021, 13:12 dereuromark @conehead true. once you know more, feel free to update any docs here. So far I only know about https://github.com/dereuromark/cakephp-tags/tree/master/docs#multiple-tags-per-model docs, which kind of include the case of multiple such relations also across different tables then implicitly, but not explicitly (yet).
# Jun 29th 2021, 13:11 theblackbird.eu `App.base` seems to work, no obvious side effects either
# Jun 29th 2021, 13:07 theblackbird.eu I generate relative URLs using eg. `$this->Url->build('/')`
# Jun 29th 2021, 13:06 ndm Try setting `App.base` to an empty string. No guarantee you're not running into side effects with that.
# Jun 29th 2021, 13:05 kevin.pfeifer well do you actually generate absolute URLs or relative URLs?
# Jun 29th 2021, 12:57 theblackbird.eu And.. it also did nothing..
# Jun 29th 2021, 12:56 theblackbird.eu To the domain? yeah
# Jun 29th 2021, 12:56 admad `'https://yourdomain'`
# Jun 29th 2021, 12:55 admad then explicitly set `App.fullBaseUrl` in app.php
# Jun 29th 2021, 12:55 theblackbird.eu I can still access through /subdirectory and / and cake is adding /subdirectory/ to all urls
# Jun 29th 2021, 12:54 theblackbird.eu Well it changed nothing
# Jun 29th 2021, 12:54 admad you can't rely on cake's default when your server config is wacko :)
# Jun 29th 2021, 12:53 theblackbird.eu In the webroot? No, i'll try that
# Jun 29th 2021, 12:52 admad @theblackbird.eu did you add `RewriteBase /subdirectory` to the htacces in webroot foler?
# Jun 29th 2021, 12:50 slackebot association names should be unique over the whole project (at least when only using cake magic)
# Jun 29th 2021, 12:50 conehead Yes, pretty much every Entity has Tags. And pretty much every Entity has AuditLogs. And many Entities are linked to each other, which have same AssocNames as well. I do have tested the software around 60%, which is by far not enough for an error that partly just silently fails. I just checked the Associations and Behaviors documentation and could not find any info about it. In my opinion there should be a fat warning, that
# Jun 29th 2021, 12:49 theblackbird.eu I would just change apache config, but sadly i'm using hosting so i don't have access to configs or anything on the server. All i can do is htaccess really..
# Jun 29th 2021, 12:39 dereuromark just ignoring the chaining found error wont solve your issues
# Jun 29th 2021, 12:38 dereuromark Have Users and Books both tags? That might explain it. Here you need to indeed tell the behavior to alias the respective junction assocs, to make sure they are unique (Tagged => XTagged and YTagged)
# Jun 29th 2021, 12:36 kevin.pfeifer well do you have tests written for your app?
# Jun 29th 2021, 12:36 conehead And I just had the case with saving now, where it does not even throw an error, just ignores and does not save the tags.
# Jun 29th 2021, 12:35 conehead Pretty much every entity on my software uses Tags :( And I think this might affect everything that finds/saves Entities through other Tables. So I gotta be afraid that something is not working anymore whenever I use $this->Table1->Table2->find/save
# Jun 29th 2021, 12:34 slackebot happening? I don't want directory name in my url. Is it a problem with my .htaccess or cakephp config or something else?