Using a status_history
table that will save the date and time a status was modified for a particular record in entries
, I'm trying to find the easiest way to also get the current status, AKA, the status with the lastest date.
For instance consider the following: status_history
+----+----------+------------+-----------+
| id | entry_id | status | timestamp |
+----+----------+------------+-----------+
| 1 | 1 | Processing | 15:05:09 |
| 2 | 1 | In Review | 15:05:18 |
| 3 | 1 | Complete | 15:05:26 |
+----+----------+------------+-----------+
And of course, our entry: entries
+----+--------+
| id | title |
+----+--------+
| 1 | Foobar |
+----+--------+
How can I retrieve, with DQL, the the latest status (technically the current status) for a particular entry, without having to maintain a latest_status_id
column in my Entry
entity?
Consider the call $entry->getCurrentStatus()
would return "Complete"
. However, in the case we have a great amount of status records for that entry, a second query to load all statuses might turn into a performance drop.
NOTE: In this article they describe it with the extra column approach, using a locking mechanism for concurrency. I'd like to avoid this approach unless this is the correct one, since we're trying not to have double relations for each table (status_history.entry_id
and entry.latest_history_id
).
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am trying to create an override feature where users type in existing login credentials, verify that a result row is returned matching those credentials, and then verifying that the user has the override role assigned to themIf both MySQL statements...
So Im having trouble finding out why Im getting NULL for my loggerdebug response for this code
I have a table where i have a multi column index (name, type)Will the index be helpful for a query like