@hypolite From a database perspective it is really bad practice to store data that is already stored. In this case it is especially bad since there are depending tables (like the one with the reported posts) that with each update is deleted and inserted over and over again.
Also when this technique was applied to some other places that have got a higher risk of race conditions we run into nightmare situations where some fields had been reverted to older situations because there had been some other (parallel) task between setting the class variables and saving all the fields. Let's say we had a situation where the one process set the avatar of a contact and a parallel process is setting the date of the last item. With the right (or better: bad) timing, the avatar or the date of last item was reverted when we worked that way.
I do get your point of input validation. But that solution opens up a bunch of other problems that are even worse than the original problem.
@hypolite This sounds like coding with one hand tied on the back and then having the need to invent some workaround to counter the self caused limitations.
So the easy task of setting the status will now consist of: - fetching all report fields (although we don't need the content for our task) - fetching all associated side table fields (the uri-ids) (although this is of no interest here) - processing the fields - returning the content - changing one value (the status) - storing all fields in the report table - delete all table entries for that report in the side table with the uri-ids - insert all table entries again, although we haven't change anything there
And this process will even getting worse, when we have the need to set the status for a whole bunch of reports (when for example 10 people report the same, then we should be able to easily close 9 reports). In that case - instead of issuing a single update command with the array of the report ids - we had to execute the above steps in some loop. This will slow down the whole process and will increase the database load as well.
I understand the reason why to work with class variables instead of associated arrays when handling with fetched data. But I don't see a reason why to limit ourselves upon updating as well.
@hypolite I thought that the "entity" only contains the class variables?
What I want to do is to create constants for the status. So they are "entity-related", I guess.
Also I want to create functions like "setDismissed" (and similar) to update the status. Also some "getOpenReports" that should return an array of reports. Concerning the returned data, I also want to return an enhanced set of data. Means: I don't only want to return the contact id of the reported contact and the uri-id of the posts, but also all needed contact related data (nick, name, url, avatar, ...) and the post related data (like title, body, creation date, ...). For this I want to create some view that then has to be called inside of that class.
@hypolite I don't understand why we should split the setting of the status in two steps? Why not directly set and store the status? I don't see any sense in storing (and overwriting) all the existing fields when we only want to change some little status field.
Concerning "createFromTableRow": I don't want to return just the array of the uri-ids there, but some array with enhanced data per record. So I guess that function needs some enhancement.
I've got a question where to place the functions to return data for the reports and to set the status. There is the report "factory" and the report "repository". At least I guess that the functions wouldn't be placed in this report "entity".
Concerning constants: I guess that they are placed in the "entity" class, aren't they?
@hypolite@tux BTW: I just realized that my small fix to check if a server is reachable seems to to ugly stuff. I will have a look at it, when I'm home.
"Twitter will no longer allow free promotion of specific social media platforms on Twitter."
"Prohibited platforms: Facebook, Instagram, Mastodon, Truth Social, Tribel, Post and Nostr"
"If violations of this policy are included in your bio and/or account name, we will temporarily suspend your account and require changes to your profile to no longer be in violation."
"Accounts that are used for the main purpose of promoting content on another social platform may be suspended. Additionally, any attempts to bypass restrictions on external links to the above prohibited social media platforms through technical or non-technical means (e.g. URL cloaking, plaintext obfuscation) is in violation of this policy. This includes, but is not limited to, spelling out “dot” for social media platforms that use “.” in the names to avoid URL creation, or sharing screenshots of your handle on a prohibited social media platform."
Es könnte also sein, dass meine Zeiten auf Twitter tatsächlich demnächst ein Ende finden - Wobei: In der Liste der Plattformen steht ja "Mastodon" und nicht das Fediverse an sich. Also müsste Friendica ja eigentlich okay sein ? Promotion of Alternative Social Platforms Policy | Twitter Help
Entwickelt Open Source in der Freizeit, hat zu viele Fahrräder und ist Fan des HSVH (Das erste "H" steht für "Handball") und von islieb, Franzbrötchen und guter Schokolade. Wunschliste: alles unter https://www.rausch.de/schokolade/Wer Amazon mag: https://www.amazon.de/hz/wishlist/ls/3VWK0ZL3MN3ZTLiberapay: https://liberapay.com/heluecht/donateBTC: 1AtJ9JVysdhWjSs5qQvp7Xt9xFdjMKSSA7BCH: qpjg2gwgr35fgz3dxy6lcpw3lt4szrfgev90uk3tfv