# |
Feb 19th 2020, 14:24 |
dereuromark |
cake itself doesnt do this it seems, would need some specific afterDelete logic |
# |
Feb 19th 2020, 14:24 |
dereuromark |
as I said, the belongsTo parent has been removed, thus leaving the hasMany items with a bad key in place. to this optional relation. |
# |
Feb 19th 2020, 14:23 |
spriz |
I might be - but what is the case - why did you end up with orphans in the first place @dereuromark? |
# |
Feb 19th 2020, 14:23 |
neon1024 |
..and GDPR removal notices and how to action them effectively |
# |
Feb 19th 2020, 14:23 |
neon1024 |
I should spend more time on deletion than I do, and more thinking about cascading and dependant deletes |
# |
Feb 19th 2020, 14:22 |
dereuromark |
I outlined the word optional :) earlier. Which clarifies the use case and why this is just data integrity. |
# |
Feb 19th 2020, 14:22 |
neon1024 |
Orphan data might go unnoticed |
# |
Feb 19th 2020, 14:22 |
dereuromark |
I think you misunderstand this specific case. |
# |
Feb 19th 2020, 14:22 |
neon1024 |
I think I’d rather it fail the delete |
# |
Feb 19th 2020, 14:21 |
spriz |
If someone by accident had an option to delete stuff, I would rather have bad data integrity than deleted data |
# |
Feb 19th 2020, 14:21 |
neon1024 |
We had a long discussion in the office once about this kind of thing, then it drifted into overly normalising your data, and into NoSQL, and from there into … |
# |
Feb 19th 2020, 14:20 |
neon1024 |
Semantics I guess, as long as it works that’s good enough for me! |
# |
Feb 19th 2020, 14:20 |
neon1024 |
I mean, sure, it’s data integrity too, but the way the database is designed would be dictated by the objects I’d say :) |
# |
Feb 19th 2020, 14:19 |
neon1024 |
I see it as business logic as a sale would have an invoice kinda thing |
# |
Feb 19th 2020, 14:14 |
dereuromark |
I wonder if cake could be doing this for us internally, auto-set to null, those relations as post hook via behavior or alike? |
# |
Feb 19th 2020, 14:14 |
dereuromark |
also way more performant this way, especially on larger datasets. |
# |
Feb 19th 2020, 14:13 |
dereuromark |
this is not business logic, but low level data integrety. big difference. |
# |
Feb 19th 2020, 14:11 |
neon1024 |
:P |
# |
Feb 19th 2020, 14:10 |
neon1024 |
Ooh, now we’re talking |
# |
Feb 19th 2020, 14:10 |
spriz |
it can also whack ya up! :v: |
# |
Feb 19th 2020, 14:10 |
spriz |
Although same issue appears when default finder is excluding "soft deleted" ones :shrug: |
# |
Feb 19th 2020, 14:10 |
neon1024 |
At least then my DB can save me from myself in some instances |
# |
Feb 19th 2020, 14:10 |
neon1024 |
..but then I think why not both? |
# |
Feb 19th 2020, 14:10 |
neon1024 |
I feel a bit bad putting what I’d think was more business logic into the database |
# |
Feb 19th 2020, 14:09 |
spriz |
but also generally I do not delete rows at all :) :) |
# |
Feb 19th 2020, 14:09 |
spriz |
it's all app-logic |
# |
Feb 19th 2020, 14:09 |
spriz |
Yeah, true PITA @dereuromark Related to discussion last week - I'm not putting FKs in DB at all currently :shrug: |
# |
Feb 19th 2020, 14:08 |
khalid |
not sure if its the correct solution but best i could come around is: ```public static function setUpBeforeClass() { Configure::write('Acl.database', 'test');``` |
# |
Feb 19th 2020, 14:08 |
dereuromark |
i found it because I was listing all non assigned entities, and after removing one relation it still didnt show (field IS NULL)^^ |
# |
Feb 19th 2020, 14:07 |
dereuromark |
yeah, I had to always fix this after some relations are already broken^^ because I forgot to add it into the migration in the first place. |
# |
Feb 19th 2020, 14:05 |
spriz |
Ah, in the migration! Mindblown! |
# |
Feb 19th 2020, 14:04 |
spriz |
How do you do that again @dereuromark? :O |
# |
Feb 19th 2020, 14:03 |
khalid |
and problem is only with Controllers Tests, Model tests works fine |
# |
Feb 19th 2020, 13:58 |
neon1024 |
How are the repository splits achieved on Github for the cakephp packages? |
# |
Feb 19th 2020, 13:58 |
dereuromark |
darn, I always forget the ```->addForeignKey('other_id', 'others', ['id'], ['delete' => 'SET_NULL'])``` part for optional hasMany => belongsTo relations where the belongsTo part could be removed and thus the data integrity is not there anymore (pointing to nonexistent keys). |
# |
Feb 19th 2020, 13:56 |
khalid |
any help will be much appreciated :) |
# |
Feb 19th 2020, 13:55 |
slackebot |
(!Configure::read('Acl.database')) { Configure::write('Acl.database', 'default');} so question is how can we use both Test and Application with ACL. |
# |
Feb 19th 2020, 13:55 |
khalid |
Hi Everyone, We are using Cakephp3 and Acl plugin from Cake, but problem is when we are running UnitTests its giving The datasource configuration "" was not found. but if we go to config/app.php and add 'Acl' => ['database' => 'test'] test works but then our main Application start failing because ACL is using Database Test now for Application too not only for tests further more i have seen Cakephp/Acl/config/bootstrap.php if |
# |
Feb 19th 2020, 13:53 |
kiwi_10 |
so question is how can we use both Test and Application with ACL. |
# |
Feb 19th 2020, 13:52 |
kiwi_10 |
further more i have seen Cakephp/Acl/config/bootstrap.php if (!Configure::read('Acl.database')) { Configure::write('Acl.database', 'default');} |
# |
Feb 19th 2020, 13:52 |
kiwi_10 |
but then our main Application start failing because ACL is using Database Test now for Application too not only for tests |