NarcisoLimboFilipino
New Member
In my Symfony2 app that represents an Asset Management System there is an entity called Asset. This entity has a OneToMany relationship with another entity called AssetLog. Each AssetLog is linked to one Status which is also an entity.For example:There might be an asset called Car.This car has a log of what has happened to it, when it has happened and who is responsible for this.Each log entry is linked to a status which could be for: perfect condition, damaged, lost, stolen, etc.What I am trying to do is writing a query in the assetRepository that will give me all assets with a certain status, say Stolen. This means for example: all cars of which their most recent log entry is linked to the status Stolen.I am struggling with the fact that I need the last log entry of each asset. And only if that entry is linked to a specific status, do I want the asset.In my specific example cars that were once stolen but returned again, should not appear in the list.Does anyone know if this is possible using the Querybuilder, and if so, how to do it?