Conversation
Notices
-
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?
-
@heluecht Entity-related constants are placed in the Entity. What kind of return data are we talking about? To update the status of a report, it would be in the Entity.
-
@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.
-
@heluecht The status values are Entity constants, the dismiss() is an Entity method (don't forget to call Repository->save() after!). I want to avoid get* and set* methods in the Entity classes. Just create methods for the use-cases we have. Do we dismiss reports? dismiss(). Do we reopen them if they were dismissed? reopen().
Querying a list of reports based on conditions is in the Repository since it's interacting with the database. You can create a joined query, then use Factory->createFromTableRow to obtain Report entities, and you can use the rest of the row fields for what you want.