Log message #4208374

# At Username Text
# Oct 10th 2019, 19:00 ricksaccous public function findAndSetLatestPost(int $somethingId) { $this->property = value}
# Oct 10th 2019, 19:00 risingtide how would I do it in the controller?
# Oct 10th 2019, 18:59 ricksaccous if you really need it in the entity you can have an arbitrary function that sets a field given an argument
# Oct 10th 2019, 18:59 ricksaccous it would make sense to do it in the controller
# Oct 10th 2019, 18:58 ricksaccous or where do you want to pass the argument
# Oct 10th 2019, 18:58 ricksaccous the view?
# Oct 10th 2019, 18:58 ricksaccous where are you passing the argument in anyway
# Oct 10th 2019, 18:58 ricksaccous contain the posts and order it, i suppose limiting it by 1 won't have an effect
# Oct 10th 2019, 18:57 ricksaccous can't you do this in the controller/model level
# Oct 10th 2019, 18:57 risingtide yes
# Oct 10th 2019, 18:57 risingtide so forums have multiple projects
# Oct 10th 2019, 18:57 ricksaccous so projects habtm forums
# Oct 10th 2019, 18:56 risingtide but each project has its own forum, but many projects can have the same forum
# Oct 10th 2019, 18:56 ricksaccous oh, so i suppose you could if you did it from projects, lol
# Oct 10th 2019, 18:56 risingtide it's a basic forum model
# Oct 10th 2019, 18:56 risingtide and threads
# Oct 10th 2019, 18:56 risingtide projects have many forums which have many posts
# Oct 10th 2019, 18:56 risingtide no, not really
# Oct 10th 2019, 18:55 ricksaccous is that something you can do?
# Oct 10th 2019, 18:55 ricksaccous and then have the entity read that field?
# Oct 10th 2019, 18:55 ricksaccous set a flag for show_latest_post or something
# Oct 10th 2019, 18:55 ricksaccous why don't you describe that in the project table itself or something
# Oct 10th 2019, 18:55 risingtide I just want it from one specific project
# Oct 10th 2019, 18:54 risingtide but it shows them from all projects
# Oct 10th 2019, 18:54 risingtide it works how I had it in the Entity when I take away the argument
# Oct 10th 2019, 18:54 risingtide yes
# Oct 10th 2019, 18:54 ricksaccous so i'm guessing forum hasMany posts?
# Oct 10th 2019, 18:54 ricksaccous it's tricky to do there are samples by ndm somewhere on stackoverflow
# Oct 10th 2019, 18:53 risingtide how would I write it in my Tables?
# Oct 10th 2019, 18:53 ricksaccous yeah
# Oct 10th 2019, 18:53 risingtide in my Tables?
# Oct 10th 2019, 18:52 ricksaccous this might be better to do a tthe query/relationship level
# Oct 10th 2019, 18:52 risingtide I am trying to get the latests post in a forum only if the post has a certain project_id
# Oct 10th 2019, 18:52 risingtide yes
# Oct 10th 2019, 18:51 ricksaccous you want this to work like a virtual field?
# Oct 10th 2019, 18:51 ricksaccous however you want that isn't that
# Oct 10th 2019, 18:51 risingtide how do I format it?
# Oct 10th 2019, 18:51 ricksaccous you don't format it like that
# Oct 10th 2019, 18:51 risingtide how do I pass an argument into this correctly?
# Oct 10th 2019, 18:50 risingtide ``` protected function _getLatestPost($project_id){
# Oct 10th 2019, 18:50 risingtide Hey I have a function in my Forum Entity